Revert to a default audio api (SDL) when config is invalid

Prevents crash when an invalid or a non existing api is used in
vbam.conf
This commit is contained in:
retro-wertz 2018-12-23 09:25:02 +08:00
parent 0d1b23c5e8
commit 0c579b20a1
1 changed files with 10 additions and 2 deletions

View File

@ -254,10 +254,18 @@ opt_desc opts[] = {
INTOPT("preferences/vsync", "VSync", wxTRANSLATE("Wait for vertical sync"), vsync, 0, 1),
/// Sound
#ifdef __WXMSW__
ENUMOPT("Sound/AudioAPI", "", wxTRANSLATE("Sound API; if unsupported, default API will be used"), gopts.audio_api, wxTRANSLATE("sdl|openal|directsound|xaudio2")),
#ifdef NO_OAL
#ifdef __WXMSW__
ENUMOPT("Sound/AudioAPI", "", wxTRANSLATE("Sound API; if unsupported, default API will be used"), gopts.audio_api, wxTRANSLATE("sdldirectsound|xaudio2")),
#else
ENUMOPT("Sound/AudioAPI", "", wxTRANSLATE("Sound API; if unsupported, default API will be used"), gopts.audio_api, wxTRANSLATE("sdl")),
#endif
#else
#ifdef __WXMSW__
ENUMOPT("Sound/AudioAPI", "", wxTRANSLATE("Sound API; if unsupported, default API will be used"), gopts.audio_api, wxTRANSLATE("sdl|openal|directsound|xaudio2")),
#else
ENUMOPT("Sound/AudioAPI", "", wxTRANSLATE("Sound API; if unsupported, default API will be used"), gopts.audio_api, wxTRANSLATE("sdl|openal")),
#endif
#endif
INTOPT("Sound/Buffers", "", wxTRANSLATE("Number of sound buffers"), gopts.audio_buffers, 2, 10),
INTOPT("Sound/Enable", "", wxTRANSLATE("Bit mask of sound channels to enable"), gopts.sound_en, 0, 0x30f),