mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	Joystick hotplug support (#4141)
* use SDL_PollEvent instead of SDL_JoystickUpdate Register hot plugged controller by GUID if they were configured in a previous session * Move SDL_PollEvent into its own thread * Don't store SDLJoystick pointer in Input Device; Get pointer on each GetStatus call * Fix that joystick_list gets cleared after SDL_Quit * Add VirtualJoystick for InputDevices thats never nullptr * fixup! Add VirtualJoystick for InputDevices thats never nullptr * fixup! fixup! Add VirtualJoystick for InputDevices thats never nullptr * Remove SDL_GameController, make SDL_Joystick* unique_ptr * fixup! Remove SDL_GameController, make SDL_Joystick* unique_ptr * Adressed feedback; fixed handling of same guid reconnects * fixup! Adressed feedback; fixed handling of same guid reconnects * merge the two joystick_lists into one * make SDLJoystick a member of VirtualJoystick * fixup! make SDLJoystick a member of VirtualJoystick * fixup! make SDLJoystick a member of VirtualJoystick * fixup! fixup! make SDLJoystick a member of VirtualJoystick
This commit is contained in:
		
							parent
							
								
									f86c993e11
								
							
						
					
					
						commit
						17978cf758
					
				
					 7 changed files with 343 additions and 102 deletions
				
			
		|  | @ -108,6 +108,7 @@ GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread) | |||
|     setWindowTitle(QString::fromStdString(window_title)); | ||||
| 
 | ||||
|     InputCommon::Init(); | ||||
|     InputCommon::StartJoystickEventHandler(); | ||||
| } | ||||
| 
 | ||||
| GRenderWindow::~GRenderWindow() { | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| // Copyright 2016 Citra Emulator Project
 | ||||
| // Copyright 2016 Citra Emulator Project
 | ||||
| // Licensed under GPLv2 or any later version
 | ||||
| // Refer to the license.txt file included.
 | ||||
| 
 | ||||
|  | @ -53,19 +53,18 @@ static QString ButtonToText(const Common::ParamPackage& param) { | |||
|     } else if (param.Get("engine", "") == "keyboard") { | ||||
|         return getKeyName(param.Get("code", 0)); | ||||
|     } else if (param.Get("engine", "") == "sdl") { | ||||
|         QString text = QString(QObject::tr("Joystick %1")).arg(param.Get("joystick", "").c_str()); | ||||
|         if (param.Has("hat")) { | ||||
|             text += QString(QObject::tr(" Hat %1 %2")) | ||||
|                         .arg(param.Get("hat", "").c_str(), param.Get("direction", "").c_str()); | ||||
|             return QString(QObject::tr("Hat %1 %2")) | ||||
|                 .arg(param.Get("hat", "").c_str(), param.Get("direction", "").c_str()); | ||||
|         } | ||||
|         if (param.Has("axis")) { | ||||
|             text += QString(QObject::tr(" Axis %1%2")) | ||||
|                         .arg(param.Get("axis", "").c_str(), param.Get("direction", "").c_str()); | ||||
|             return QString(QObject::tr("Axis %1%2")) | ||||
|                 .arg(param.Get("axis", "").c_str(), param.Get("direction", "").c_str()); | ||||
|         } | ||||
|         if (param.Has("button")) { | ||||
|             text += QString(QObject::tr(" Button %1")).arg(param.Get("button", "").c_str()); | ||||
|             return QString(QObject::tr("Button %1")).arg(param.Get("button", "").c_str()); | ||||
|         } | ||||
|         return text; | ||||
|         return QString(); | ||||
|     } else { | ||||
|         return QObject::tr("[unknown]"); | ||||
|     } | ||||
|  | @ -81,13 +80,12 @@ static QString AnalogToText(const Common::ParamPackage& param, const std::string | |||
|             return QString(QObject::tr("[unused]")); | ||||
|         } | ||||
| 
 | ||||
|         QString text = QString(QObject::tr("Joystick %1")).arg(param.Get("joystick", "").c_str()); | ||||
|         if (dir == "left" || dir == "right") { | ||||
|             text += QString(QObject::tr(" Axis %1")).arg(param.Get("axis_x", "").c_str()); | ||||
|             return QString(QObject::tr("Axis %1")).arg(param.Get("axis_x", "").c_str()); | ||||
|         } else if (dir == "up" || dir == "down") { | ||||
|             text += QString(QObject::tr(" Axis %1")).arg(param.Get("axis_y", "").c_str()); | ||||
|             return QString(QObject::tr("Axis %1")).arg(param.Get("axis_y", "").c_str()); | ||||
|         } | ||||
|         return text; | ||||
|         return QString(); | ||||
|     } else { | ||||
|         return QObject::tr("[unknown]"); | ||||
|     } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue