mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r16700) -Fix: if allegro fails to start or fails open a window or sound card fall back to another driver
This commit is contained in:
parent
791187cd12
commit
c29afac0a7
|
@ -18,15 +18,16 @@ extern int _allegro_instance_count;
|
||||||
|
|
||||||
const char *MusicDriver_Allegro::Start(const char * const *param)
|
const char *MusicDriver_Allegro::Start(const char * const *param)
|
||||||
{
|
{
|
||||||
if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, NULL)) return NULL;
|
if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, NULL)) return "Failed to set up Allegro";
|
||||||
_allegro_instance_count++;
|
_allegro_instance_count++;
|
||||||
|
|
||||||
/* Initialise the sound */
|
/* Initialise the sound */
|
||||||
if (install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, NULL) != 0) return NULL;
|
if (install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, NULL) != 0) return "Failed to set up Allegro sound";
|
||||||
|
|
||||||
/* Okay, there's no soundcard */
|
/* Okay, there's no soundcard */
|
||||||
if (midi_card == MIDI_NONE) {
|
if (midi_card == MIDI_NONE) {
|
||||||
DEBUG(driver, 0, "allegro: no midi card found");
|
DEBUG(driver, 0, "allegro: no midi card found");
|
||||||
|
return "No sound card found";
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -45,16 +45,16 @@ extern int _allegro_instance_count;
|
||||||
|
|
||||||
const char *SoundDriver_Allegro::Start(const char * const *parm)
|
const char *SoundDriver_Allegro::Start(const char * const *parm)
|
||||||
{
|
{
|
||||||
if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, NULL)) return NULL;
|
if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, NULL)) return "Failed to set up Allegro";
|
||||||
_allegro_instance_count++;
|
_allegro_instance_count++;
|
||||||
|
|
||||||
/* Initialise the sound */
|
/* Initialise the sound */
|
||||||
if (install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, NULL) != 0) return NULL;
|
if (install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, NULL) != 0) return "Failed to set up Allegro sound";
|
||||||
|
|
||||||
/* Okay, there's no soundcard */
|
/* Okay, there's no soundcard */
|
||||||
if (digi_card == DIGI_NONE) {
|
if (digi_card == DIGI_NONE) {
|
||||||
DEBUG(driver, 0, "allegro: no sound card found");
|
DEBUG(driver, 0, "allegro: no sound card found");
|
||||||
return NULL;
|
return "No sound card found";
|
||||||
}
|
}
|
||||||
|
|
||||||
_stream = play_audio_stream(BUFFER_SIZE, 16, true, 11025, 255, 128);
|
_stream = play_audio_stream(BUFFER_SIZE, 16, true, 11025, 255, 128);
|
||||||
|
|
|
@ -404,7 +404,7 @@ int _allegro_instance_count = 0;
|
||||||
|
|
||||||
const char *VideoDriver_Allegro::Start(const char * const *parm)
|
const char *VideoDriver_Allegro::Start(const char * const *parm)
|
||||||
{
|
{
|
||||||
if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, NULL)) return NULL;
|
if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, NULL)) return "Failed to set up Allegro";
|
||||||
_allegro_instance_count++;
|
_allegro_instance_count++;
|
||||||
|
|
||||||
install_timer();
|
install_timer();
|
||||||
|
@ -425,7 +425,9 @@ const char *VideoDriver_Allegro::Start(const char * const *parm)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GetVideoModes();
|
GetVideoModes();
|
||||||
CreateMainSurface(_cur_resolution.width, _cur_resolution.height);
|
if (!CreateMainSurface(_cur_resolution.width, _cur_resolution.height)) {
|
||||||
|
return "Failed to set up Allegro video";
|
||||||
|
}
|
||||||
MarkWholeScreenDirty();
|
MarkWholeScreenDirty();
|
||||||
set_close_button_callback(HandleExitGameRequest);
|
set_close_button_callback(HandleExitGameRequest);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue