This commit is contained in:
Lwmte 2025-02-14 23:10:40 +01:00
parent a64825b6f1
commit 562637f599
2 changed files with 10 additions and 9 deletions

View file

@ -19,6 +19,7 @@ TombEngine releases are located in this repository (alongside with Tomb Editor):
* Fixed flickering rat emitter. * Fixed flickering rat emitter.
* Fixed player model submerging into the floor while swimming underwater. * Fixed player model submerging into the floor while swimming underwater.
* Fixed custom shatter sounds with custom sound IDs not playing correctly. * Fixed custom shatter sounds with custom sound IDs not playing correctly.
* Fixed crashes with sound samples larger than 2 megabytes.
### New Features ### New Features
* Added multithreading and an option for it to flow system settings. * Added multithreading and an option for it to flow system settings.

View file

@ -1459,19 +1459,19 @@ void LoadSamples()
TENLog("Sample count: " + std::to_string(sampleCount), LogLevel::Info); TENLog("Sample count: " + std::to_string(sampleCount), LogLevel::Info);
int uncompressedSize = 0; std::vector<char> buffer;
int compressedSize = 0; buffer.reserve(2 * 1024 * 1024);
char* buffer = (char*)malloc(2 * 1024 * 1024);
for (int i = 0; i < sampleCount; i++) for (int i = 0; i < sampleCount; i++)
{ {
uncompressedSize = ReadInt32(); int uncompressedSize = ReadInt32();
compressedSize = ReadInt32(); int compressedSize = ReadInt32();
ReadBytes(buffer, compressedSize);
LoadSample(buffer, compressedSize, uncompressedSize, i);
}
free(buffer); buffer.resize(compressedSize);
ReadBytes(buffer.data(), compressedSize);
LoadSample(buffer.data(), compressedSize, uncompressedSize, i);
}
} }
void LoadBoxes() void LoadBoxes()