Fix AdpcmBook allocations (#2214)

This commit is contained in:
GaryOderNichts 2022-12-21 06:15:05 +01:00 committed by GitHub
parent a1a6c07549
commit 1a10d8f627
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -127,7 +127,7 @@ typedef struct {
typedef struct {
/* 0x00 */ s32 order;
/* 0x04 */ s32 npredictors;
/* 0x08 */ s16 book[1]; // size 8 * order * npredictors. 8-byte aligned
/* 0x08 */ s16 book[]; // size 8 * order * npredictors. 8-byte aligned
} AdpcmBook; // size >= 0x8
typedef struct

View File

@ -1137,7 +1137,7 @@ extern "C" SoundFontSample* ResourceMgr_LoadAudioSample(const char* path)
sampleC->unk_bit26 = sample->unk_bit26;
sampleC->unk_bit25 = sample->unk_bit25;
sampleC->book = new AdpcmBook[sample->book.books.size() * sizeof(int16_t)];
sampleC->book = (AdpcmBook*) malloc(sizeof(AdpcmBook) + sample->book.books.size() * sizeof(int16_t));
sampleC->book->npredictors = sample->book.npredictors;
sampleC->book->order = sample->book.order;