Few changes to fix the preload failures

Adds extra error output for erroneous buffer preload
SndStream now correctly sets sndfile to null when it closes, Also extra error reporting around the read function
SFXResource now returns a new threadsaferef each time we openstream. This should only be called on a fresh instance.
This commit is contained in:
marauder2k7 2026-04-06 10:46:04 +01:00
parent d4c0c6fd3d
commit b625250af0
3 changed files with 100 additions and 53 deletions

View file

@ -79,5 +79,9 @@ bool SFXResource::exists( String filename )
ThreadSafeRef<SFXStream> SFXResource::openStream()
{
return mStream;
// Open a fresh independent stream from the file each time
ThreadSafeRef<SFXStream> freshStream = SFXFileStream::create(mFileName);
if (!freshStream)
Con::errorf("SFXResource::openStream() - failed to reopen '%s'", mFileName.c_str());
return freshStream;
}