Merge pull request #1420 from bnnm/xmp

- xmp: increase exts limit for v3.8.5.62+
This commit is contained in:
bnnm 2023-09-15 17:30:25 +02:00 committed by GitHub
commit 33cce92418
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 5 deletions

View File

@ -169,6 +169,10 @@ static int read_fmt(int big_endian, STREAMFILE* sf, off_t offset, riff_fmt_chunk
case 0x0002: /* MSADPCM */
if (fmt->bps == 4) {
/* ADPCMWAVEFORMAT extra data:
* - samples per frame (16b)
* - num coefs (16b), always 7
* - N x2 coefs (configurable but in practice fixed) */
fmt->coding_type = coding_MSADPCM;
if (!msadpcm_check_coefs(sf, fmt->offset + 0x08 + 0x14))
goto fail;
@ -180,7 +184,7 @@ static int read_fmt(int big_endian, STREAMFILE* sf, off_t offset, riff_fmt_chunk
goto fail;
}
break;
case 0x003: /* floating point PCM */
case 0x0003: /* floating point PCM */
if (fmt->bps == 32) {
fmt->coding_type = coding_PCMFLOAT;
} else {
@ -190,6 +194,8 @@ static int read_fmt(int big_endian, STREAMFILE* sf, off_t offset, riff_fmt_chunk
break;
case 0x0011: /* MS-IMA ADPCM [Layton Brothers: Mystery Room (iOS/Android)] */
/* IMAADPCMWAVEFORMAT extra data:
* - samples per frame (16b) */
if (fmt->bps != 4) goto fail;
fmt->coding_type = coding_MS_IMA;
break;

View File

@ -841,7 +841,7 @@ static void set_body_chunk(txth_header* txth) {
if (!txth->sf_body)
return;
/* treat chunks as subsongs */
/* treat chunks as subsongs (less subsongs than chunks could be allowed to ignore some chunks but it's kinda odd) */
if (txth->subsong_count > 1 && txth->subsong_count == txth->chunk_count)
txth->chunk_number = txth->target_subsong;
if (txth->chunk_number == 0)

View File

@ -29,8 +29,10 @@
#define SAMPLE_BUFFER_SIZE 1024
/* XMPlay extension list, only needed to associate extensions in Windows */
/* todo: as of v3.8.2.17, any more than ~1000 will crash XMplay's file list screen (but not using the non-native Winamp plugin...) */
#define EXTENSION_LIST_SIZE 1000 /* (0x2000 * 2) */
/* with <v3.8.5.62, any more than ~1000 will crash XMplay's file list screen (but not using the non-native Winamp plugin?) */
#define EXTENSION_LIST_SIZE (0x2000 * 6)
#define EXTENSION_LIST_SIZE_OLD 1000
#define EXTENSION_LIST_SIZE_OLD_VERSION 0x0308053d /* less than v3.8.5.62 */
#define XMPLAY_MAX_PATH 32768
/* XMPlay function library */
@ -421,12 +423,16 @@ static void build_extension_list() {
size_t ext_list_len;
int i, written;
int limit = EXTENSION_LIST_SIZE;
if (xmpfmisc->GetVersion() <= EXTENSION_LIST_SIZE_OLD_VERSION)
limit = EXTENSION_LIST_SIZE_OLD;
written = sprintf(working_extension_list, "%s%c", "vgmstream files",'\0');
ext_list = vgmstream_get_formats(&ext_list_len);
for (i=0; i < ext_list_len; i++) {
written += add_extension(EXTENSION_LIST_SIZE-written, working_extension_list + written, ext_list[i]);
written += add_extension(limit-written, working_extension_list + written, ext_list[i]);
}
working_extension_list[written-1] = '\0'; /* remove last "/" */
}