mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 13:35:12 +00:00
Do a file type check on custom audio
This commit is contained in:
parent
5206e125df
commit
f64cd4b8e2
1 changed files with 16 additions and 0 deletions
|
@ -163,6 +163,22 @@ static bool audio_sanity_check(struct BassAudio* audio, bool isStream, const cha
|
|||
}
|
||||
|
||||
struct BassAudio* audio_load_internal(const char* filename, bool isStream) {
|
||||
// check file type
|
||||
bool validFileType = false;
|
||||
const char* fileTypes[] = { ".mp3", ".aiff", ".ogg", NULL };
|
||||
const char** ft = fileTypes;
|
||||
while (*ft != NULL) {
|
||||
if (str_ends_with((char*)filename, (char*)*ft)) {
|
||||
validFileType = true;
|
||||
break;
|
||||
}
|
||||
ft++;
|
||||
}
|
||||
if (!validFileType) {
|
||||
LOG_LUA_LINE("Tried to load audio file with invalid file type: %s", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// find mod file in mod list
|
||||
bool foundModFile = false;
|
||||
struct ModFile* modFile = NULL;
|
||||
|
|
Loading…
Reference in a new issue