mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-24 18:21:05 +00:00
Improve shutdowns
This commit is contained in:
parent
ecb059daa9
commit
326e2f110d
@ -64,6 +64,15 @@ void Init(ControllerBackends backend) {
|
|||||||
CoreTiming::ScheduleEvent(frame_ticks, input_event);
|
CoreTiming::ScheduleEvent(frame_ticks, input_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShutDown() {
|
||||||
|
//Delete the current user input plugin
|
||||||
|
if(g_user_input != nullptr)
|
||||||
|
{
|
||||||
|
delete g_user_input;
|
||||||
|
g_user_input = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,6 +49,9 @@ protected:
|
|||||||
///Initialize the user input system
|
///Initialize the user input system
|
||||||
void Init(ControllerBackends backend);
|
void Init(ControllerBackends backend);
|
||||||
|
|
||||||
|
///Deactive the user input system
|
||||||
|
void ShutDown();
|
||||||
|
|
||||||
///InputCommon 'plugin'
|
///InputCommon 'plugin'
|
||||||
extern ControllerBase* g_user_input;
|
extern ControllerBase* g_user_input;
|
||||||
|
|
||||||
|
@ -18,7 +18,10 @@ SDLController::SDLController() {
|
|||||||
controller.touch_screen_x = 0;
|
controller.touch_screen_x = 0;
|
||||||
controller.touch_screen_y = 0;
|
controller.touch_screen_y = 0;
|
||||||
|
|
||||||
Init();
|
//Immediately shutdown if initialization fails
|
||||||
|
if(!Init()) {
|
||||||
|
ShutDown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDLController::~SDLController() {
|
SDLController::~SDLController() {
|
||||||
@ -37,7 +40,6 @@ bool SDLController::Init() {
|
|||||||
jpad = SDL_JoystickOpen(index);
|
jpad = SDL_JoystickOpen(index);
|
||||||
|
|
||||||
if(jpad == nullptr) {
|
if(jpad == nullptr) {
|
||||||
std::cout<<"What\n";
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,8 +60,7 @@ void SDLController::ShutDown() {
|
|||||||
SDL_JoystickClose(jpad);
|
SDL_JoystickClose(jpad);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Delete the current user input plugin
|
InputCommon::ShutDown();
|
||||||
delete g_user_input;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDLController::Poll() {
|
void SDLController::Poll() {
|
||||||
|
Loading…
Reference in New Issue
Block a user