Proper SDL library initialization for Audio and Joystick subsystems (ported from master)

This commit is contained in:
Damjan Adamic
2015-04-25 18:03:47 +02:00
parent df2318a45d
commit 2a667d1d53
5 changed files with 55 additions and 5 deletions
+19 -1
View File
@@ -48,6 +48,9 @@
#include <QSplashScreen>
#include <QThread>
#include <iostream>
#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
#include <SDL.h>
#endif
#include "mainwindow.h"
#include "eeprominterface.h"
#include "appdata.h"
@@ -95,7 +98,18 @@ int main(int argc, char *argv[])
app.installTranslator(&qtTranslator);
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
uint32_t sdlFlags = 0;
#ifdef JOYSTICKS
sdlFlags |= SDL_INIT_JOYSTICK;
#endif
#ifdef SIMU_AUDIO
sdlFlags |= SDL_INIT_AUDIO;
#endif
SDL_Init(sdlFlags);
#endif
registerEEpromInterfaces();
registerOpenTxFirmwares();
registerSimulators();
@@ -134,5 +148,9 @@ int main(int argc, char *argv[])
unregisterFirmwares();
unregisterEEpromInterfaces();
#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
SDL_Quit();
#endif
return result;
}