mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 00:20:47 +01:00
Fix minor compiler warnings
This commit is contained in:
parent
13fcb28b3c
commit
b97fc632be
@ -308,7 +308,7 @@ int main(int argc, char ** argv) {
|
||||
if (!play_sdtout && !print_adxencd && !print_oggenc && !print_batchvar) {
|
||||
printf("samples to play: %d (%.4lf seconds)\n", len_samples, (double)len_samples / vgmstream->sample_rate);
|
||||
}
|
||||
fade_samples = fade_seconds * vgmstream->sample_rate;
|
||||
fade_samples = (int32_t)(fade_seconds * vgmstream->sample_rate);
|
||||
|
||||
if (loop_count > 0 && ignore_fade) {
|
||||
vgmstream->loop_target = (int)loop_count;
|
||||
@ -356,7 +356,7 @@ int main(int argc, char ** argv) {
|
||||
if (samples_into_fade > 0) {
|
||||
double fadedness = (double)(fade_samples-samples_into_fade)/fade_samples;
|
||||
for (k = 0; k < vgmstream->channels; k++) {
|
||||
buf[j*vgmstream->channels+k] = buf[j*vgmstream->channels+k]*fadedness;
|
||||
buf[j*vgmstream->channels+k] = (sample)buf[j*vgmstream->channels+k]*fadedness;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -423,7 +423,7 @@ int main(int argc, char ** argv) {
|
||||
if (samples_into_fade > 0) {
|
||||
double fadedness = (double)(fade_samples-samples_into_fade)/fade_samples;
|
||||
for (k = 0; k < vgmstream->channels; k++) {
|
||||
buf[j*vgmstream->channels+k] = buf[j*vgmstream->channels+k]*fadedness;
|
||||
buf[j*vgmstream->channels+k] = (sample)buf[j*vgmstream->channels+k]*fadedness;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -436,20 +436,19 @@ fail:
|
||||
static void ms_audio_get_samples(ms_sample_data * msd, STREAMFILE *streamFile, int start_packet, int channels_per_packet, int bytes_per_packet, int samples_per_frame, int samples_per_subframe, int bits_frame_size) {
|
||||
int frames = 0, samples = 0, loop_start_frame = 0, loop_end_frame = 0, start_skip = 0, end_skip = 0;
|
||||
|
||||
uint32_t first_frame_b, packet_skip_count = 0, frame_size_b, packet_size_b, header_size_b;
|
||||
uint64_t offset_b, packet_offset_b, frame_offset_b;
|
||||
size_t size;
|
||||
size_t first_frame_b, packet_skip_count = 0, frame_size_b, packet_size_b, header_size_b;
|
||||
off_t offset_b, packet_offset_b, frame_offset_b;
|
||||
|
||||
uint32_t packet_size = bytes_per_packet;
|
||||
size_t packet_size = bytes_per_packet;
|
||||
off_t offset = msd->data_offset;
|
||||
uint32_t stream_offset_b = msd->data_offset * 8;
|
||||
off_t max_offset = msd->data_offset + msd->data_size;
|
||||
off_t stream_offset_b = msd->data_offset * 8;
|
||||
|
||||
offset += start_packet * packet_size;
|
||||
size = offset + msd->data_size;
|
||||
packet_size_b = packet_size * 8;
|
||||
|
||||
/* read packets */
|
||||
while (offset < size) {
|
||||
while (offset < max_offset) {
|
||||
offset_b = offset * 8; /* global offset in bits */
|
||||
offset += packet_size; /* global offset in bytes */
|
||||
|
||||
@ -678,7 +677,7 @@ void wmapro_get_samples(ms_sample_data * msd, STREAMFILE *streamFile, int block_
|
||||
return;
|
||||
}
|
||||
samples_per_frame = wma_get_samples_per_frame(version, sample_rate, decode_flags);
|
||||
bits_frame_size = floor(log(block_align) / log(2)) + 4; /* max bits needed to represent this block_align */
|
||||
bits_frame_size = (int)floor(log(block_align) / log(2)) + 4; /* max bits needed to represent this block_align */
|
||||
samples_per_subframe = 0; /* not really needed WMAPro can't use loop subframes (complex subframe lengths) */
|
||||
msd->xma_version = 0; /* signal it's not XMA */
|
||||
|
||||
@ -705,7 +704,8 @@ void wma_get_samples(ms_sample_data * msd, STREAMFILE *streamFile, int block_ali
|
||||
else {
|
||||
/* variable frames per packet (mini-header values) */
|
||||
off_t offset = msd->data_offset;
|
||||
while (offset < msd->data_size) { /* read packets (superframes) */
|
||||
off_t max_offset = msd->data_offset + msd->data_size;
|
||||
while (offset < max_offset) { /* read packets (superframes) */
|
||||
int packet_frames;
|
||||
uint8_t header = read_8bit(offset, streamFile); /* upper nibble: index; lower nibble: frames */
|
||||
|
||||
|
@ -177,7 +177,7 @@ void decode_pcmfloat(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspac
|
||||
int sample_pcm;
|
||||
|
||||
sample_float = (float*)&sample_int;
|
||||
sample_pcm = floor((*sample_float) * 32767.f + .5f);
|
||||
sample_pcm = (int)floor((*sample_float) * 32767.f + .5f);
|
||||
|
||||
outbuf[sample_count] = clamp16(sample_pcm);
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ static void pcm_convert_float_to_16(vorbis_custom_codec_data * data, sample * ou
|
||||
sample *ptr = outbuf + i;
|
||||
float *mono = pcm[i];
|
||||
for (j = 0; j < samples_to_do; j++) {
|
||||
int val = floor(mono[j] * 32767.f + .5f);
|
||||
int val = (int)floor(mono[j] * 32767.f + .5f);
|
||||
if (val > 32767) val = 32767;
|
||||
if (val < -32768) val = -32768;
|
||||
|
||||
|
@ -13,11 +13,11 @@
|
||||
/* DEFS */
|
||||
/* **************************************************************************** */
|
||||
|
||||
static int build_header_identification(uint8_t * buf, size_t bufsize, int channels, int sample_rate, int blocksize_short, int blocksize_long);
|
||||
static int build_header_comment(uint8_t * buf, size_t bufsize);
|
||||
static int get_packet_header(STREAMFILE *streamFile, off_t offset, wwise_header_t header_type, int * granulepos, size_t * packet_size, int big_endian);
|
||||
static int rebuild_packet(uint8_t * obuf, size_t obufsize, STREAMFILE *streamFile, off_t offset, vorbis_custom_codec_data * data, int big_endian);
|
||||
static int rebuild_setup(uint8_t * obuf, size_t obufsize, STREAMFILE *streamFile, off_t offset, vorbis_custom_codec_data * data, int big_endian, int channels);
|
||||
static size_t build_header_identification(uint8_t * buf, size_t bufsize, int channels, int sample_rate, int blocksize_short, int blocksize_long);
|
||||
static size_t build_header_comment(uint8_t * buf, size_t bufsize);
|
||||
static size_t get_packet_header(STREAMFILE *streamFile, off_t offset, wwise_header_t header_type, int * granulepos, size_t * packet_size, int big_endian);
|
||||
static size_t rebuild_packet(uint8_t * obuf, size_t obufsize, STREAMFILE *streamFile, off_t offset, vorbis_custom_codec_data * data, int big_endian);
|
||||
static size_t rebuild_setup(uint8_t * obuf, size_t obufsize, STREAMFILE *streamFile, off_t offset, vorbis_custom_codec_data * data, int big_endian, int channels);
|
||||
|
||||
static int ww2ogg_generate_vorbis_packet(vgm_bitstream * ow, vgm_bitstream * iw, STREAMFILE *streamFile, off_t offset, vorbis_custom_codec_data * data, int big_endian);
|
||||
static int ww2ogg_generate_vorbis_setup(vgm_bitstream * ow, vgm_bitstream * iw, vorbis_custom_codec_data * data, int channels, size_t packet_size, STREAMFILE *streamFile);
|
||||
@ -126,7 +126,7 @@ fail:
|
||||
/* **************************************************************************** */
|
||||
|
||||
/* loads info from a wwise packet header */
|
||||
static int get_packet_header(STREAMFILE *streamFile, off_t offset, wwise_header_t header_type, int * granulepos, size_t * packet_size, int big_endian) {
|
||||
static size_t get_packet_header(STREAMFILE *streamFile, off_t offset, wwise_header_t header_type, int * granulepos, size_t * packet_size, int big_endian) {
|
||||
int32_t (*read_32bit)(off_t,STREAMFILE*) = big_endian ? read_32bitBE : read_32bitLE;
|
||||
int16_t (*read_16bit)(off_t,STREAMFILE*) = big_endian ? read_16bitBE : read_16bitLE;
|
||||
|
||||
@ -153,7 +153,7 @@ static int get_packet_header(STREAMFILE *streamFile, off_t offset, wwise_header_
|
||||
}
|
||||
|
||||
/* Transforms a Wwise data packet into a real Vorbis one (depending on config) */
|
||||
static int rebuild_packet(uint8_t * obuf, size_t obufsize, STREAMFILE *streamFile, off_t offset, vorbis_custom_codec_data * data, int big_endian) {
|
||||
static size_t rebuild_packet(uint8_t * obuf, size_t obufsize, STREAMFILE *streamFile, off_t offset, vorbis_custom_codec_data * data, int big_endian) {
|
||||
vgm_bitstream ow, iw;
|
||||
int rc, granulepos;
|
||||
size_t header_size, packet_size;
|
||||
@ -196,7 +196,7 @@ fail:
|
||||
|
||||
|
||||
/* Transforms a Wwise setup packet into a real Vorbis one (depending on config). */
|
||||
static int rebuild_setup(uint8_t * obuf, size_t obufsize, STREAMFILE *streamFile, off_t offset, vorbis_custom_codec_data * data, int big_endian, int channels) {
|
||||
static size_t rebuild_setup(uint8_t * obuf, size_t obufsize, STREAMFILE *streamFile, off_t offset, vorbis_custom_codec_data * data, int big_endian, int channels) {
|
||||
vgm_bitstream ow, iw;
|
||||
int rc, granulepos;
|
||||
size_t header_size, packet_size;
|
||||
@ -238,8 +238,8 @@ fail:
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int build_header_identification(uint8_t * buf, size_t bufsize, int channels, int sample_rate, int blocksize_0_exp, int blocksize_1_exp) {
|
||||
int bytes = 0x1e;
|
||||
static size_t build_header_identification(uint8_t * buf, size_t bufsize, int channels, int sample_rate, int blocksize_0_exp, int blocksize_1_exp) {
|
||||
size_t bytes = 0x1e;
|
||||
uint8_t blocksizes;
|
||||
|
||||
if (bytes > bufsize) return 0;
|
||||
@ -260,8 +260,8 @@ static int build_header_identification(uint8_t * buf, size_t bufsize, int channe
|
||||
return bytes;
|
||||
}
|
||||
|
||||
static int build_header_comment(uint8_t * buf, size_t bufsize) {
|
||||
int bytes = 0x19;
|
||||
static size_t build_header_comment(uint8_t * buf, size_t bufsize) {
|
||||
size_t bytes = 0x19;
|
||||
|
||||
if (bytes > bufsize) return 0;
|
||||
|
||||
|
@ -17,7 +17,7 @@ typedef struct {
|
||||
int block_chunk;
|
||||
|
||||
off_t stream_offset;
|
||||
off_t stream_size;
|
||||
size_t stream_size;
|
||||
|
||||
} awc_header;
|
||||
|
||||
@ -187,12 +187,15 @@ static int parse_awc_header(STREAMFILE* streamFile, awc_header* awc) {
|
||||
|
||||
/* get stream tags */
|
||||
for (i = 0; i < tag_count; i++) {
|
||||
uint64_t tag_header, tag, size, offset;
|
||||
uint64_t tag_header;
|
||||
uint8_t tag;
|
||||
size_t size;
|
||||
off_t offset;
|
||||
|
||||
tag_header = (uint64_t)read_64bit(off + 0x08*i,streamFile);
|
||||
tag = (tag_header >> 56) & 0xFF; /* 8b */
|
||||
size = (tag_header >> 28) & 0x0FFFFFFF; /* 28b */
|
||||
offset = (tag_header >> 0) & 0x0FFFFFFF; /* 28b */
|
||||
tag = (uint8_t)((tag_header >> 56) & 0xFF); /* 8b */
|
||||
size = (size_t)((tag_header >> 28) & 0x0FFFFFFF); /* 28b */
|
||||
offset = (off_t)((tag_header >> 0) & 0x0FFFFFFF); /* 28b */
|
||||
|
||||
/* Tags are apparently part of a hash derived from a word ("data", "format", etc).
|
||||
* If music + 1ch, the header and data chunks can repeat for no reason (sometimes not even pointed). */
|
||||
|
@ -232,9 +232,9 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
|
||||
int fact_sample_skip = 0;
|
||||
|
||||
int loop_flag = 0;
|
||||
int loop_start_sample = 0, loop_end_sample = 0;
|
||||
long loop_start_ms = -1, loop_end_ms = -1;
|
||||
off_t loop_start_offset = -1, loop_end_offset = -1;
|
||||
int32_t loop_start_wsmp = -1, loop_end_wsmp = -1;
|
||||
int32_t loop_start_smpl = -1, loop_end_smpl = -1;
|
||||
|
||||
int FormatChunkFound = 0, DataChunkFound = 0, JunkFound = 0;
|
||||
|
||||
@ -348,8 +348,8 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
|
||||
* 0x2c: start, 0x30: end, 0x34: fraction, 0x38: play count */
|
||||
if (read_32bitLE(current_chunk+0x08+0x28, streamFile)==0) {
|
||||
loop_flag = 1;
|
||||
loop_start_offset = read_32bitLE(current_chunk+0x08+0x2c, streamFile);
|
||||
loop_end_offset = read_32bitLE(current_chunk+0x08+0x30, streamFile);
|
||||
loop_start_smpl = read_32bitLE(current_chunk+0x08+0x2c, streamFile);
|
||||
loop_end_smpl = read_32bitLE(current_chunk+0x08+0x30, streamFile);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -364,9 +364,9 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
|
||||
/* 0x14: size, 0x18: loop type (0=forward, 1=release), 0x1c: loop start, 0x20: loop length */
|
||||
if (read_32bitLE(current_chunk+0x08+0x18, streamFile)==0) {
|
||||
loop_flag = 1;
|
||||
loop_start_sample = read_32bitLE(current_chunk+0x08+0x1c, streamFile);
|
||||
loop_end_sample = read_32bitLE(current_chunk+0x08+0x20, streamFile);
|
||||
loop_end_sample += loop_start_sample;
|
||||
loop_start_wsmp = read_32bitLE(current_chunk+0x08+0x1c, streamFile);
|
||||
loop_end_wsmp = read_32bitLE(current_chunk+0x08+0x20, streamFile);
|
||||
loop_end_wsmp += loop_start_wsmp;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -529,8 +529,8 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
|
||||
|
||||
/* RIFF loop/sample values are absolute (with skip samples), adjust */
|
||||
if (loop_flag) {
|
||||
loop_start_offset -= ffmpeg_data->skipSamples;
|
||||
loop_end_offset -= ffmpeg_data->skipSamples;
|
||||
loop_start_smpl -= (int32_t)ffmpeg_data->skipSamples;
|
||||
loop_end_smpl -= (int32_t)ffmpeg_data->skipSamples;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -561,8 +561,8 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
|
||||
vgmstream->num_samples = fact_sample_count;
|
||||
/* RIFF loop/sample values are absolute (with skip samples), adjust */
|
||||
if (loop_flag) {
|
||||
loop_start_offset -= fact_sample_skip;
|
||||
loop_end_offset -= fact_sample_skip;
|
||||
loop_start_smpl -= fact_sample_skip;
|
||||
loop_end_smpl -= fact_sample_skip;
|
||||
}
|
||||
|
||||
break;
|
||||
@ -604,14 +604,14 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
|
||||
vgmstream->loop_end_sample = (long long)loop_end_ms*fmt.sample_rate/1000;
|
||||
vgmstream->meta_type = meta_RIFF_WAVE_labl;
|
||||
}
|
||||
else if (loop_start_offset >= 0) {
|
||||
vgmstream->loop_start_sample = loop_start_offset;
|
||||
vgmstream->loop_end_sample = loop_end_offset;
|
||||
else if (loop_start_smpl >= 0) {
|
||||
vgmstream->loop_start_sample = loop_start_smpl;
|
||||
vgmstream->loop_end_sample = loop_end_smpl;
|
||||
vgmstream->meta_type = meta_RIFF_WAVE_smpl;
|
||||
}
|
||||
else if (loop_start_sample >= 0) {
|
||||
vgmstream->loop_start_sample = loop_start_sample;
|
||||
vgmstream->loop_end_sample = loop_end_sample;
|
||||
else if (loop_start_wsmp >= 0) {
|
||||
vgmstream->loop_start_sample = loop_start_wsmp;
|
||||
vgmstream->loop_end_sample = loop_end_wsmp;
|
||||
vgmstream->meta_type = meta_RIFF_WAVE_wsmp;
|
||||
}
|
||||
else if (mwv && mwv_ctrl_offset != -1) {
|
||||
|
@ -304,32 +304,33 @@ typedef struct {
|
||||
static size_t sead_decryption_read(STREAMFILE *streamfile, uint8_t *dest, off_t offset, size_t length, sead_decryption_data* data) {
|
||||
/* Found in FFXII_TZA.exe (same key in SCD Ogg V3) */
|
||||
static const uint8_t encryption_key[0x100] = {
|
||||
0x3A, 0x32, 0x32, 0x32, 0x03, 0x7E, 0x12, 0xF7, 0xB2, 0xE2, 0xA2, 0x67, 0x32, 0x32, 0x22, 0x32, // 00-0F
|
||||
0x32, 0x52, 0x16, 0x1B, 0x3C, 0xA1, 0x54, 0x7B, 0x1B, 0x97, 0xA6, 0x93, 0x1A, 0x4B, 0xAA, 0xA6, // 10-1F
|
||||
0x7A, 0x7B, 0x1B, 0x97, 0xA6, 0xF7, 0x02, 0xBB, 0xAA, 0xA6, 0xBB, 0xF7, 0x2A, 0x51, 0xBE, 0x03, // 20-2F
|
||||
0xF4, 0x2A, 0x51, 0xBE, 0x03, 0xF4, 0x2A, 0x51, 0xBE, 0x12, 0x06, 0x56, 0x27, 0x32, 0x32, 0x36, // 30-3F
|
||||
0x32, 0xB2, 0x1A, 0x3B, 0xBC, 0x91, 0xD4, 0x7B, 0x58, 0xFC, 0x0B, 0x55, 0x2A, 0x15, 0xBC, 0x40, // 40-4F
|
||||
0x92, 0x0B, 0x5B, 0x7C, 0x0A, 0x95, 0x12, 0x35, 0xB8, 0x63, 0xD2, 0x0B, 0x3B, 0xF0, 0xC7, 0x14, // 50-5F
|
||||
0x51, 0x5C, 0x94, 0x86, 0x94, 0x59, 0x5C, 0xFC, 0x1B, 0x17, 0x3A, 0x3F, 0x6B, 0x37, 0x32, 0x32, // 60-6F
|
||||
0x30, 0x32, 0x72, 0x7A, 0x13, 0xB7, 0x26, 0x60, 0x7A, 0x13, 0xB7, 0x26, 0x50, 0xBA, 0x13, 0xB4, // 70-7F
|
||||
0x2A, 0x50, 0xBA, 0x13, 0xB5, 0x2E, 0x40, 0xFA, 0x13, 0x95, 0xAE, 0x40, 0x38, 0x18, 0x9A, 0x92, // 80-8F
|
||||
0xB0, 0x38, 0x00, 0xFA, 0x12, 0xB1, 0x7E, 0x00, 0xDB, 0x96, 0xA1, 0x7C, 0x08, 0xDB, 0x9A, 0x91, // 90-9F
|
||||
0xBC, 0x08, 0xD8, 0x1A, 0x86, 0xE2, 0x70, 0x39, 0x1F, 0x86, 0xE0, 0x78, 0x7E, 0x03, 0xE7, 0x64, // A0-AF
|
||||
0x51, 0x9C, 0x8F, 0x34, 0x6F, 0x4E, 0x41, 0xFC, 0x0B, 0xD5, 0xAE, 0x41, 0xFC, 0x0B, 0xD5, 0xAE, // B0-BF
|
||||
0x41, 0xFC, 0x3B, 0x70, 0x71, 0x64, 0x33, 0x32, 0x12, 0x32, 0x32, 0x36, 0x70, 0x34, 0x2B, 0x56, // C0-CF
|
||||
0x22, 0x70, 0x3A, 0x13, 0xB7, 0x26, 0x60, 0xBA, 0x1B, 0x94, 0xAA, 0x40, 0x38, 0x00, 0xFA, 0xB2, // D0-DF
|
||||
0xE2, 0xA2, 0x67, 0x32, 0x32, 0x12, 0x32, 0xB2, 0x32, 0x32, 0x32, 0x32, 0x75, 0xA3, 0x26, 0x7B, // E0-EF
|
||||
0x83, 0x26, 0xF9, 0x83, 0x2E, 0xFF, 0xE3, 0x16, 0x7D, 0xC0, 0x1E, 0x63, 0x21, 0x07, 0xE3, 0x01, // F0-FF
|
||||
0x3A,0x32,0x32,0x32,0x03,0x7E,0x12,0xF7,0xB2,0xE2,0xA2,0x67,0x32,0x32,0x22,0x32, // 00-0F
|
||||
0x32,0x52,0x16,0x1B,0x3C,0xA1,0x54,0x7B,0x1B,0x97,0xA6,0x93,0x1A,0x4B,0xAA,0xA6, // 10-1F
|
||||
0x7A,0x7B,0x1B,0x97,0xA6,0xF7,0x02,0xBB,0xAA,0xA6,0xBB,0xF7,0x2A,0x51,0xBE,0x03, // 20-2F
|
||||
0xF4,0x2A,0x51,0xBE,0x03,0xF4,0x2A,0x51,0xBE,0x12,0x06,0x56,0x27,0x32,0x32,0x36, // 30-3F
|
||||
0x32,0xB2,0x1A,0x3B,0xBC,0x91,0xD4,0x7B,0x58,0xFC,0x0B,0x55,0x2A,0x15,0xBC,0x40, // 40-4F
|
||||
0x92,0x0B,0x5B,0x7C,0x0A,0x95,0x12,0x35,0xB8,0x63,0xD2,0x0B,0x3B,0xF0,0xC7,0x14, // 50-5F
|
||||
0x51,0x5C,0x94,0x86,0x94,0x59,0x5C,0xFC,0x1B,0x17,0x3A,0x3F,0x6B,0x37,0x32,0x32, // 60-6F
|
||||
0x30,0x32,0x72,0x7A,0x13,0xB7,0x26,0x60,0x7A,0x13,0xB7,0x26,0x50,0xBA,0x13,0xB4, // 70-7F
|
||||
0x2A,0x50,0xBA,0x13,0xB5,0x2E,0x40,0xFA,0x13,0x95,0xAE,0x40,0x38,0x18,0x9A,0x92, // 80-8F
|
||||
0xB0,0x38,0x00,0xFA,0x12,0xB1,0x7E,0x00,0xDB,0x96,0xA1,0x7C,0x08,0xDB,0x9A,0x91, // 90-9F
|
||||
0xBC,0x08,0xD8,0x1A,0x86,0xE2,0x70,0x39,0x1F,0x86,0xE0,0x78,0x7E,0x03,0xE7,0x64, // A0-AF
|
||||
0x51,0x9C,0x8F,0x34,0x6F,0x4E,0x41,0xFC,0x0B,0xD5,0xAE,0x41,0xFC,0x0B,0xD5,0xAE, // B0-BF
|
||||
0x41,0xFC,0x3B,0x70,0x71,0x64,0x33,0x32,0x12,0x32,0x32,0x36,0x70,0x34,0x2B,0x56, // C0-CF
|
||||
0x22,0x70,0x3A,0x13,0xB7,0x26,0x60,0xBA,0x1B,0x94,0xAA,0x40,0x38,0x00,0xFA,0xB2, // D0-DF
|
||||
0xE2,0xA2,0x67,0x32,0x32,0x12,0x32,0xB2,0x32,0x32,0x32,0x32,0x75,0xA3,0x26,0x7B, // E0-EF
|
||||
0x83,0x26,0xF9,0x83,0x2E,0xFF,0xE3,0x16,0x7D,0xC0,0x1E,0x63,0x21,0x07,0xE3,0x01, // F0-FF
|
||||
};
|
||||
size_t bytes_read;
|
||||
off_t encrypted_offset = data->header_size;
|
||||
int i;
|
||||
|
||||
bytes_read = streamfile->read(streamfile, dest, offset, length);
|
||||
|
||||
/* decrypt data (xor) */
|
||||
if (offset >= data->header_size) {
|
||||
if (offset >= encrypted_offset) {
|
||||
for (i = 0; i < bytes_read; i++) {
|
||||
dest[i] ^= encryption_key[(data->key_start + (offset - data->header_size) + i) % 0x100];
|
||||
dest[i] ^= encryption_key[(data->key_start + (offset - encrypted_offset) + i) % 0x100];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -451,7 +451,7 @@ VGMSTREAM * init_vgmstream_wwise(STREAMFILE *streamFile) {
|
||||
|
||||
vgmstream->num_samples = msd.num_samples;
|
||||
if (!vgmstream->num_samples)
|
||||
vgmstream->num_samples = ffmpeg_data->totalSamples; /* very wrong, from avg-br */
|
||||
vgmstream->num_samples = (int32_t)ffmpeg_data->totalSamples; /* very wrong, from avg-br */
|
||||
//num_samples seem to be found in the last "seek" table entry too, as: entry / channels / 2
|
||||
}
|
||||
|
||||
@ -470,7 +470,7 @@ VGMSTREAM * init_vgmstream_wwise(STREAMFILE *streamFile) {
|
||||
vgmstream->coding_type = coding_FFmpeg;
|
||||
vgmstream->layout_type = layout_none;
|
||||
|
||||
vgmstream->num_samples = ffmpeg_data->totalSamples;
|
||||
vgmstream->num_samples = (int32_t)ffmpeg_data->totalSamples;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -420,7 +420,7 @@ VGMSTREAM * init_vgmstream_xwb(STREAMFILE *streamFile) {
|
||||
|
||||
/* no wma_bytes_to_samples, this should be ok */
|
||||
if (!vgmstream->num_samples)
|
||||
vgmstream->num_samples = ffmpeg_data->totalSamples;
|
||||
vgmstream->num_samples = (int32_t)ffmpeg_data->totalSamples;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -492,7 +492,7 @@ static void fakename_close(FAKENAME_STREAMFILE *streamfile) {
|
||||
free(streamfile);
|
||||
}
|
||||
|
||||
STREAMFILE *open_fakename_streamfile(STREAMFILE *streamfile, char * fakename, char* fakeext) {
|
||||
STREAMFILE *open_fakename_streamfile(STREAMFILE *streamfile, const char * fakename, const char* fakeext) {
|
||||
FAKENAME_STREAMFILE *this_sf;
|
||||
|
||||
if (!streamfile || (!fakename && !fakeext)) return NULL;
|
||||
|
@ -88,7 +88,7 @@ STREAMFILE *open_io_streamfile(STREAMFILE *streamfile, void* data, size_t data_s
|
||||
* Can be used to trick a meta's extension check (to call from another, with a modified SF).
|
||||
* When fakename isn't supplied it's read from the streamfile, and the extension swapped with fakeext.
|
||||
* If the fakename is an existing file, open won't work on it as it'll reopen the fake-named streamfile. */
|
||||
STREAMFILE *open_fakename_streamfile(STREAMFILE *streamfile, char * fakename, char * fakeext);
|
||||
STREAMFILE *open_fakename_streamfile(STREAMFILE *streamfile, const char * fakename, const char * fakeext);
|
||||
|
||||
/* A streamfile formed from multiple streamfiles, their data joined during reads.
|
||||
* Can be used when data is segmented in multiple separate files.
|
||||
|
@ -912,9 +912,9 @@ int32_t get_vgmstream_play_samples(double looptimes, double fadeseconds, double
|
||||
+ (vgmstream->num_samples - vgmstream->loop_end_sample);
|
||||
}
|
||||
else {
|
||||
return vgmstream->loop_start_sample
|
||||
return (int32_t)(vgmstream->loop_start_sample
|
||||
+ (vgmstream->loop_end_sample - vgmstream->loop_start_sample) * looptimes
|
||||
+ (fadedelayseconds + fadeseconds) * vgmstream->sample_rate;
|
||||
+ (fadedelayseconds + fadeseconds) * vgmstream->sample_rate);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -170,11 +170,11 @@ static off_t wasf_get_offset(WINAMP_STREAMFILE *streamfile) {
|
||||
}
|
||||
|
||||
static void wasf_get_name(WINAMP_STREAMFILE *streamfile, char *buffer, size_t length) {
|
||||
return streamfile->stdiosf->get_name(streamfile->stdiosf, buffer, length);
|
||||
streamfile->stdiosf->get_name(streamfile->stdiosf, buffer, length);
|
||||
}
|
||||
|
||||
static void wasf_get_realname(WINAMP_STREAMFILE *streamfile, char *buffer, size_t length) {
|
||||
return streamfile->stdiosf->get_realname(streamfile->stdiosf, buffer, length);
|
||||
streamfile->stdiosf->get_realname(streamfile->stdiosf, buffer, length);
|
||||
}
|
||||
|
||||
static STREAMFILE *wasf_open(WINAMP_STREAMFILE *streamFile, const char *const filename, size_t buffersize) {
|
||||
|
Loading…
Reference in New Issue
Block a user