mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-29 19:37:30 +01:00
Merge branch 'master' of https://github.com/kode54/vgmstream into fixes
This commit is contained in:
commit
25f7a64dc6
@ -94,8 +94,8 @@ fail:
|
||||
/* Tries to find the decryption key from a list. Simply decodes a few frames and checks if there aren't too many
|
||||
* clipped samples, as it's common for invalid keys (though possible with valid keys in poorly mastered files). */
|
||||
static void find_hca_key(hca_codec_data * hca_data, clHCA * hca, uint8_t * buffer, int header_size, unsigned int * out_key1, unsigned int * out_key2) {
|
||||
sample testbuf[clHCA_samplesPerBlock * 16]; /* max 16 channels, let's be generous */
|
||||
int i;
|
||||
sample *testbuf = NULL, *temp;
|
||||
int i, j;
|
||||
size_t keys_length = sizeof(hcakey_list) / sizeof(hcakey_info);
|
||||
|
||||
int min_clip_count = -1;
|
||||
@ -124,16 +124,20 @@ static void find_hca_key(hca_codec_data * hca_data, clHCA * hca, uint8_t * buffe
|
||||
if (clHCA_Decode(hca, buffer, header_size, 0) < 0) continue;
|
||||
if (clHCA_getInfo(hca, &hca_data->info) < 0) continue;
|
||||
|
||||
if (hca_data->info.channelCount > 16) {
|
||||
VGM_LOG("HCA: too many channels, cannot test keys\n");
|
||||
goto end;
|
||||
temp = (sample *)realloc(testbuf, sizeof(sample) * clHCA_samplesPerBlock * hca_data->info.channelCount);
|
||||
if (!temp) {
|
||||
if (testbuf) free(testbuf);
|
||||
return;
|
||||
}
|
||||
testbuf = temp;
|
||||
|
||||
/* test enough frames, but not too many */
|
||||
while (f < HCA_KEY_MAX_TEST_FRAMES && f < hca_data->info.blockCount) {
|
||||
decode_hca(hca_data, testbuf, clHCA_samplesPerBlock, hca_data->info.channelCount);
|
||||
j = clHCA_samplesPerBlock;
|
||||
decode_hca(hca_data, testbuf, j, hca_data->info.channelCount);
|
||||
|
||||
for (s = 0; s < clHCA_samplesPerBlock; s++) {
|
||||
j *= hca_data->info.channelCount;
|
||||
for (s = 0; s < j; s++) {
|
||||
if (testbuf[s] != 0x0000 && testbuf[s] != 0xFFFF)
|
||||
sample_count++; /* ignore upper/lower blank samples */
|
||||
|
||||
|
@ -8,7 +8,7 @@ VGMSTREAM * init_vgmstream_ps2_rxws(STREAMFILE *streamFile) {
|
||||
STREAMFILE * streamHeader = NULL;
|
||||
off_t start_offset, chunk_offset, name_offset = 0;
|
||||
size_t data_size, chunk_size;
|
||||
int loop_flag = 0, channel_count, is_separate, type, sample_rate;
|
||||
int loop_flag = 0, channel_count, is_separate = false, type, sample_rate;
|
||||
int32_t loop_start, loop_end;
|
||||
int total_streams, target_stream = streamFile->stream_index;
|
||||
|
||||
|
@ -11,7 +11,7 @@ VGMSTREAM * init_vgmstream_sgxd(STREAMFILE *streamFile) {
|
||||
off_t start_offset, data_offset, chunk_offset, name_offset = 0;
|
||||
size_t data_size;
|
||||
|
||||
int is_sgx, is_sgb;
|
||||
int is_sgx, is_sgb = false;
|
||||
int loop_flag, channels, type;
|
||||
int sample_rate, num_samples, loop_start_sample, loop_end_sample;
|
||||
int total_streams, target_stream = streamFile->stream_index;
|
||||
|
Loading…
x
Reference in New Issue
Block a user