QSound: prevent negative memory capacity

This commit is contained in:
tildearrow 2023-01-13 14:11:32 -05:00
parent ab532cca84
commit a8eedea925

View file

@ -707,11 +707,11 @@ const void* DivPlatformQSound::getSampleMem(int index) {
}
size_t DivPlatformQSound::getSampleMemCapacity(int index) {
return index == 0 ? 16777216 : index == 1 ? (16777216 - sampleMemUsage) : 0;
return index == 0 ? 16777216 : index == 1 ? MAX(0,16777216 - sampleMemUsage) : 0;
}
size_t DivPlatformQSound::getSampleMemUsage(int index) {
return index == 0 ? sampleMemLen : index == 1 ? (sampleMemLenBS - sampleMemUsage) : 0;
return index == 0 ? sampleMemLen : index == 1 ? MAX(0,sampleMemLenBS - sampleMemUsage) : 0;
}
bool DivPlatformQSound::isSampleLoaded(int index, int sample) {