This commit is contained in:
DepressedTWM 2026-06-01 14:27:50 -04:00
parent c0101d1d6c
commit 12cdf73b0d
2 changed files with 10 additions and 6 deletions

View file

@ -51,8 +51,9 @@ struct SDLRWIoContext{
: ops(SDL_IOFromFile(filename, "r")), : ops(SDL_IOFromFile(filename, "r")),
filename(filename) filename(filename)
{ {
if (!ops) if (!ops){
crash(Exception::SDLError, "Failed to open file: %s", SDL_GetError()); crash(Exception::SDLError, "Failed to open file: %s", SDL_GetError());
}
} }
~SDLRWIoContext(){ ~SDLRWIoContext(){
@ -594,17 +595,20 @@ void FileSystem::openRead(OpenHandler &handler, const char *filename){
PHYSFS_enumerate(dir, openReadEnumCB, &data); PHYSFS_enumerate(dir, openReadEnumCB, &data);
} }
if (data.physfsError) if (data.physfsError){
crash(Exception::PHYSFSError, "PhysFS: %s", data.physfsError); crash(Exception::PHYSFSError, "PhysFS: %s", data.physfsError);
}
if (data.matchCount == 0) if (data.matchCount == 0){
crash(Exception::NoFileError, "%s", filename); crash(Exception::NoFileError, "%s", filename);
}
} }
void FileSystem::openReadRaw(SDL_IOStream* &stream, const char *filename){ void FileSystem::openReadRaw(SDL_IOStream* &stream, const char *filename){
PHYSFS_File *handle = PHYSFS_openRead(filename); PHYSFS_File *handle = PHYSFS_openRead(filename);
if (!handle) if (!handle){
crash(Exception::NoFileError, "%s", filename); crash(Exception::NoFileError, "%s", filename);
}
initReadOps(handle, stream); initReadOps(handle, stream);
} }

View file

@ -80,7 +80,7 @@ struct VorbisSource : ALDataSource{
if (error){ if (error){
SDL_CloseIO(&src); SDL_CloseIO(&src);
crash("Vorbisfile: Cannot read ogg file", Exception::MKXPError, true); crash(Exception::MKXPError, "Vorbisfile: Cannot read ogg file");
} }
/* Extract bitstream info */ /* Extract bitstream info */
@ -90,7 +90,7 @@ struct VorbisSource : ALDataSource{
if (info.channels > 2){ if (info.channels > 2){
ov_clear(&vf); ov_clear(&vf);
SDL_CloseIO(&src); SDL_CloseIO(&src);
crash("Cannot handle audio with more than 2 channels", Exception::MKXPError, true); crash(Exception::MKXPError, "Cannot handle audio with more than 2 channels");
} }
info.alFormat = chooseALFormat(sizeof(int16_t), info.channels); info.alFormat = chooseALFormat(sizeof(int16_t), info.channels);