From 09ac66388c01187ed6a402efcad76984c8af9a2e Mon Sep 17 00:00:00 2001 From: James Rowe Date: Thu, 20 Sep 2018 00:28:05 -0600 Subject: Input: Remove global variables from SDL Input Changes the interface as well to remove any unique methods that frontends needed to call such as StartJoystickEventHandler by conditionally starting the polling thread only if the frontend hasn't started it already. Additionally, moves all global state into a single SDLState class in order to guarantee that the destructors are called in the proper order --- src/yuzu_cmd/emu_window/emu_window_sdl2.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/yuzu_cmd') diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp index 7df8eff53..de7a26e14 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp @@ -135,16 +135,16 @@ bool EmuWindow_SDL2::SupportsRequiredGLExtensions() { } EmuWindow_SDL2::EmuWindow_SDL2(bool fullscreen) { - InputCommon::Init(); - - SDL_SetMainReady(); - // Initialize the window if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) { LOG_CRITICAL(Frontend, "Failed to initialize SDL2! Exiting..."); exit(1); } + InputCommon::Init(); + + SDL_SetMainReady(); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); @@ -201,11 +201,9 @@ EmuWindow_SDL2::EmuWindow_SDL2(bool fullscreen) { } EmuWindow_SDL2::~EmuWindow_SDL2() { - InputCommon::SDL::CloseSDLJoysticks(); + InputCommon::Shutdown(); SDL_GL_DeleteContext(gl_context); SDL_Quit(); - - InputCommon::Shutdown(); } void EmuWindow_SDL2::SwapBuffers() { @@ -262,7 +260,6 @@ void EmuWindow_SDL2::PollEvents() { is_open = false; break; default: - InputCommon::SDL::HandleGameControllerEvent(event); break; } } -- cgit v1.2.3