Check return value of soundInit().
soundInit() returns a bool to indicate success, and failure inevitably leads to crashes as the emulator tries to use a NULL soundDriver. On false, popup an error dialog saying that the sound driver failed to initialize, this is at least better than crashes, which will also need to be fixed. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
parent
410ede543c
commit
f1099a213a
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-02-24 20:58+0000\n"
|
||||
"POT-Creation-Date: 2020-03-07 13:29+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -155,7 +155,7 @@ msgstr ""
|
|||
msgid "VBA cheat lists (*.clt)|*.clt|CHT cheat lists (*.cht)|*.cht"
|
||||
msgstr ""
|
||||
|
||||
#: guiinit.cpp:241 panel.cpp:413
|
||||
#: guiinit.cpp:241 panel.cpp:417
|
||||
msgid "Loaded cheats"
|
||||
msgstr ""
|
||||
|
||||
|
@ -607,7 +607,7 @@ msgstr ""
|
|||
msgid "Confirm import"
|
||||
msgstr ""
|
||||
|
||||
#: cmdevents.cpp:907 panel.cpp:356
|
||||
#: cmdevents.cpp:907 panel.cpp:360
|
||||
#, c-format
|
||||
msgid "Loaded battery %s"
|
||||
msgstr ""
|
||||
|
@ -690,7 +690,7 @@ msgstr ""
|
|||
msgid "Wrote battery %s"
|
||||
msgstr ""
|
||||
|
||||
#: cmdevents.cpp:1100 panel.cpp:662
|
||||
#: cmdevents.cpp:1100 panel.cpp:666
|
||||
#, c-format
|
||||
msgid "Error writing battery %s"
|
||||
msgstr ""
|
||||
|
@ -800,18 +800,22 @@ msgstr ""
|
|||
msgid "Using interframe blending #%d"
|
||||
msgstr ""
|
||||
|
||||
#: cmdevents.cpp:2761
|
||||
#: cmdevents.cpp:2672 panel.cpp:176 panel.cpp:277
|
||||
msgid "Could not initialize the sound driver!"
|
||||
msgstr ""
|
||||
|
||||
#: cmdevents.cpp:2764
|
||||
msgid "Nintendo GameBoy (+Color+Advance) emulator."
|
||||
msgstr ""
|
||||
|
||||
#: cmdevents.cpp:2762
|
||||
#: cmdevents.cpp:2765
|
||||
msgid ""
|
||||
"Copyright (C) 1999-2003 Forgotten\n"
|
||||
"Copyright (C) 2004-2006 VBA development team\n"
|
||||
"Copyright (C) 2007-2017 VBA-M development team"
|
||||
msgstr ""
|
||||
|
||||
#: cmdevents.cpp:2763
|
||||
#: cmdevents.cpp:2766
|
||||
msgid ""
|
||||
"This program is free software: you can redistribute it and/or modify\n"
|
||||
"it under the terms of the GNU General Public License as published by\n"
|
||||
|
@ -827,11 +831,11 @@ msgid ""
|
|||
"along with this program. If not, see http://www.gnu.org/licenses ."
|
||||
msgstr ""
|
||||
|
||||
#: cmdevents.cpp:3027
|
||||
#: cmdevents.cpp:3030
|
||||
msgid "LAN link is already active. Disable link mode to disconnect."
|
||||
msgstr ""
|
||||
|
||||
#: cmdevents.cpp:3033
|
||||
#: cmdevents.cpp:3036
|
||||
msgid "Network is not supported in local mode."
|
||||
msgstr ""
|
||||
|
||||
|
@ -940,7 +944,7 @@ msgstr ""
|
|||
msgid "%s is not a valid ROM file"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:91 panel.cpp:152 panel.cpp:213
|
||||
#: panel.cpp:91 panel.cpp:152 panel.cpp:215
|
||||
msgid "Problem loading file"
|
||||
msgstr ""
|
||||
|
||||
|
@ -949,113 +953,113 @@ msgstr ""
|
|||
msgid "Unable to load Game Boy ROM %s"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:189 panel.cpp:287
|
||||
#: panel.cpp:191 panel.cpp:291
|
||||
#, c-format
|
||||
msgid "Could not load BIOS %s"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:212
|
||||
#: panel.cpp:214
|
||||
#, c-format
|
||||
msgid "Unable to load Game Boy Advance ROM %s"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:445
|
||||
#: panel.cpp:449
|
||||
msgid " player "
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:610
|
||||
#: panel.cpp:614
|
||||
#, c-format
|
||||
msgid "Loaded state %s"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:610
|
||||
#: panel.cpp:614
|
||||
#, c-format
|
||||
msgid "Error loading state %s"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:634
|
||||
#: panel.cpp:638
|
||||
#, c-format
|
||||
msgid "Saved state %s"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:634
|
||||
#: panel.cpp:638
|
||||
#, c-format
|
||||
msgid "Error saving state %s"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:838
|
||||
#: panel.cpp:842
|
||||
#, c-format
|
||||
msgid "Fullscreen mode %dx%d-%d@%d not supported; looking for another"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:876
|
||||
#: panel.cpp:880
|
||||
#, c-format
|
||||
msgid "Fullscreen mode %dx%d-%d@%d not supported"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:881
|
||||
#: panel.cpp:885
|
||||
#, c-format
|
||||
msgid "Valid mode: %dx%d-%d@%d"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:889
|
||||
#: panel.cpp:893
|
||||
#, c-format
|
||||
msgid "Chose mode %dx%d-%d@%d"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:893
|
||||
#: panel.cpp:897
|
||||
#, c-format
|
||||
msgid "Failed to change mode to %dx%d-%d@%d"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:977
|
||||
#: panel.cpp:981
|
||||
msgid "Not a valid GBA cartridge"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:1120
|
||||
#: panel.cpp:1124
|
||||
msgid "No memory for rewinding"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:1130
|
||||
#: panel.cpp:1134
|
||||
msgid "Error writing rewind state"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:2341
|
||||
#: panel.cpp:2345
|
||||
msgid "memory allocation error"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:2344
|
||||
#: panel.cpp:2348
|
||||
msgid "error initializing codec"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:2347
|
||||
#: panel.cpp:2351
|
||||
msgid "error writing to output file"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:2350
|
||||
#: panel.cpp:2354
|
||||
msgid "can't guess output format from file name"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:2355
|
||||
#: panel.cpp:2359
|
||||
msgid "programming error; aborting!"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:2372 panel.cpp:2403
|
||||
#: panel.cpp:2376 panel.cpp:2407
|
||||
#, c-format
|
||||
msgid "Unable to begin recording to %s (%s)"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:2431
|
||||
#: panel.cpp:2435
|
||||
#, c-format
|
||||
msgid "Error in audio/video recording (%s); aborting"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:2437
|
||||
#: panel.cpp:2441
|
||||
#, c-format
|
||||
msgid "Error in audio recording (%s); aborting"
|
||||
msgstr ""
|
||||
|
||||
#: panel.cpp:2447
|
||||
#: panel.cpp:2451
|
||||
#, c-format
|
||||
msgid "Error in video recording (%s); aborting"
|
||||
msgstr ""
|
||||
|
|
|
@ -519,6 +519,7 @@ void soundReset()
|
|||
{
|
||||
if (!soundDriver)
|
||||
return;
|
||||
|
||||
soundDriver->reset();
|
||||
|
||||
remake_stereo_buffer();
|
||||
|
|
|
@ -2667,7 +2667,10 @@ EVT_HANDLER_MASK(SoundConfigure, "Sound options...", CMDEN_NREC_ANY)
|
|||
// or init-only options
|
||||
(oapi == AUD_XAUDIO2 && oupmix != gopts.upmix) || (oapi == AUD_FAUDIO && oupmix != gopts.upmix) || (oapi == AUD_DIRECTSOUND && ohw != gopts.dsound_hw_accel))) {
|
||||
soundShutdown();
|
||||
soundInit();
|
||||
|
||||
if (!soundInit()) {
|
||||
wxLogError(_("Could not initialize the sound driver!"));
|
||||
}
|
||||
}
|
||||
|
||||
soundSetVolume((float)gopts.sound_vol / 100.0);
|
||||
|
|
|
@ -172,7 +172,9 @@ void GameArea::LoadGame(const wxString& name)
|
|||
gb_effects_config.echo = (float)gopts.gb_echo / 100.0;
|
||||
gb_effects_config.stereo = (float)gopts.gb_stereo / 100.0;
|
||||
gbSoundSetDeclicking(gopts.gb_declick);
|
||||
soundInit();
|
||||
if (!soundInit()) {
|
||||
wxLogError(_("Could not initialize the sound driver!"));
|
||||
}
|
||||
soundSetEnable(gopts.sound_en);
|
||||
gbSoundSetSampleRate(!gopts.sound_qual ? 48000 : 44100 / (1 << (gopts.sound_qual - 1)));
|
||||
soundSetVolume((float)gopts.sound_vol / 100.0);
|
||||
|
@ -271,7 +273,9 @@ void GameArea::LoadGame(const wxString& name)
|
|||
|
||||
doMirroring(mirroringEnable);
|
||||
// start sound; this must happen before CPU stuff
|
||||
soundInit();
|
||||
if (!soundInit()) {
|
||||
wxLogError(_("Could not initialize the sound driver!"));
|
||||
}
|
||||
soundSetEnable(gopts.sound_en);
|
||||
soundSetSampleRate(!gopts.sound_qual ? 48000 : 44100 / (1 << (gopts.sound_qual - 1)));
|
||||
soundSetVolume((float)gopts.sound_vol / 100.0);
|
||||
|
|
Loading…
Reference in New Issue