[SDL] Add global helper to setup the library.

Call to SDLHelper::Prepare() is needed before first SDL_InitSubSystem().
- Sets hints (SDL configuration vars).
- Configures logging.
This commit is contained in:
Joel Linn
2020-04-23 12:14:53 +02:00
committed by Rick Gibbed
parent 5463798631
commit 6267c73c4c
10 changed files with 149 additions and 42 deletions

View File

@@ -7,8 +7,9 @@ project("xenia-apu-sdl")
kind("StaticLib")
language("C++")
links({
"xenia-base",
"xenia-apu",
"xenia-base",
"xenia-helper-sdl",
"SDL2",
})
defines({

View File

@@ -13,9 +13,7 @@
#include "xenia/apu/apu_flags.h"
#include "xenia/base/logging.h"
#if XE_PLATFORM_WIN32
#include "xenia/base/platform_win.h"
#endif // XE_PLATFORM_WIN32
#include "xenia/helper/sdl/sdl_helper.h"
namespace xe {
namespace apu {
@@ -31,7 +29,6 @@ SDLAudioDriver::~SDLAudioDriver() {
};
bool SDLAudioDriver::Initialize() {
XELOG_SDL_INIT()
SDL_version ver = {};
SDL_GetVersion(&ver);
if ((ver.major < 2) || (ver.major == 2 && ver.minor == 0 && ver.patch < 8)) {
@@ -41,6 +38,9 @@ bool SDLAudioDriver::Initialize() {
ver.major, ver.minor, ver.patch);
}
if (!xe::helper::sdl::SDLHelper::Prepare()) {
return false;
}
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) {
return false;
}