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