Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support all WaveBank versions #320

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions src/FACT_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
#define FACT_CONTENT_VERSION_3_4 45
#define FACT_CONTENT_VERSION_3_1 44
#define FACT_CONTENT_VERSION_3_0 43
#define FACT_CONTENT_VERSION_2_4 41
#define FACT_CONTENT_VERSION_2_0 37

static inline int FACT_INTERNAL_SupportedContent(uint16_t version)
{
Expand Down Expand Up @@ -3105,7 +3107,17 @@ uint32_t FACT_INTERNAL_ParseWaveBank(
#define DOSWAP_64(x) x = FAudio_swap64BE(x)

fileOffset = offset;
READ(&header, sizeof(header))

FAudio_zero(&header, sizeof(header));
READ(&header.dwSignature, sizeof(header.dwSignature));
READ(&header.dwVersion, sizeof(header.dwVersion));
if (header.dwVersion > FACT_CONTENT_VERSION_2_4)
{
READ(&header.dwHeaderVersion, sizeof(header.dwHeaderVersion));
}

READ(&header.Segments, sizeof(header.Segments));

se = header.dwSignature == 0x57424E44;
if (se)
{
Expand All @@ -3123,12 +3135,20 @@ uint32_t FACT_INTERNAL_ParseWaveBank(
return -1; /* TODO: NOT XACT FILE */
}

if (!FACT_INTERNAL_SupportedContent(header.dwVersion))
/* We support all Wavebank versions - Restore when SoundBank support them also. */
/*if (!FACT_INTERNAL_SupportedContent(header.dwVersion))
{
return -2;
}
*/
if ( header.dwVersion < FACT_CONTENT_VERSION_2_4 ||
header.dwVersion > FACT_CONTENT_VERSION )
{
return -2;
}

if (!FACT_INTERNAL_SupportedWBContent(header.dwHeaderVersion))
if ( header.dwVersion > FACT_CONTENT_VERSION_2_4 &&
!FACT_INTERNAL_SupportedWBContent(header.dwHeaderVersion) )
{
return -3;
}
Expand Down
Loading