mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-23 14:33:36 +00:00
fix: improper buffer handling in playSoundTick() (#393)
Signed-off-by: kernaltrap <kernaltrap@proton.me>
This commit is contained in:
parent
da89ab8c5a
commit
5264bdf335
|
|
@ -464,19 +464,16 @@ void SoundEngine::playMusicTick() {
|
|||
|
||||
for (const char* r : roots) {
|
||||
for (const char* e : {".ogg", ".mp3", ".wav"}) {
|
||||
char c[512];
|
||||
// try with folder prefix (music/ or cds/)
|
||||
snprintf(c, 512, "%s%s%s%s%s", base.c_str(), r, folder,
|
||||
snprintf(m_szStreamName, sizeof(m_szStreamName), "%s%s%s%s%s", base.c_str(), r, folder,
|
||||
track, e);
|
||||
if (PlatformFileIO.exists(c)) {
|
||||
strncpy(m_szStreamName, c, 511);
|
||||
if (PlatformFileIO.exists(m_szStreamName)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
// try without folder prefix
|
||||
snprintf(c, 512, "%s%s%s%s", base.c_str(), r, track, e);
|
||||
if (PlatformFileIO.exists(c)) {
|
||||
strncpy(m_szStreamName, c, 511);
|
||||
snprintf(m_szStreamName, sizeof(m_szStreamName), "%s%s%s%s", base.c_str(), r, track, e);
|
||||
if (PlatformFileIO.exists(m_szStreamName)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1961,4 +1958,4 @@ ConsoleSoundEngine::ScheduledSound::ScheduledSound(int iSound, float x, float y,
|
|||
this->volume = volume;
|
||||
this->pitch = pitch;
|
||||
this->delay = delay;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue