@@ -1213,6 +1213,18 @@ static WiimoteEmu::Wiimote* load_saved_controller_config(unsigned port, unsigned
12131213 return nullptr ; // nothing found, applies hard-coded defaults
12141214}
12151215
1216+ // returns retropad_expr on its own, with additional mouse bindings
1217+ static std::string bindMouse (const std::string& retropad_expr, const std::string& mouse_target)
1218+ {
1219+ static const bool enable_default_mouse_bindings =
1220+ Libretro::Options::GetCached<bool >(Libretro::Options::retroarch_core::ENABLE_DEFAULT_MOUSE_BINDINGS , /* def=*/ true );
1221+
1222+ if (!enable_default_mouse_bindings)
1223+ return retropad_expr;
1224+
1225+ return retropad_expr + " | `" + mouse_target + " `" ;
1226+ }
1227+
12161228void retro_set_controller_port_device_gc (unsigned port, unsigned device)
12171229{
12181230 std::string devJoypad = Libretro::Input::GetQualifiedName (port, RETRO_DEVICE_JOYPAD );
@@ -1413,12 +1425,12 @@ void retro_set_controller_port_device_wii(unsigned port, unsigned device)
14131425 ncStick->SetControlExpression (1 , " `" + devAnalog + " :Y0+`" ); // Down
14141426 ncStick->SetControlExpression (2 , " `" + devAnalog + " :X0-`" ); // Left
14151427 ncStick->SetControlExpression (3 , " `" + devAnalog + " :X0+`" ); // Right
1416- ncShake->SetControlExpression (0 , " L2 | ` " + devMouse + " :Middle` " ); // Nunchuk shake X
1417- ncShake->SetControlExpression (1 , " L2 | ` " + devMouse + " :Middle` " ); // Nunchuk shake Y
1418- ncShake->SetControlExpression (2 , " L2 | ` " + devMouse + " :Middle` " ); // Nunchuk shake Z
1428+ ncShake->SetControlExpression (0 , bindMouse ( " L2" , devMouse + " :Middle" ) ); // Nunchuk shake X
1429+ ncShake->SetControlExpression (1 , bindMouse ( " L2" , devMouse + " :Middle" ) ); // Nunchuk shake Y
1430+ ncShake->SetControlExpression (2 , bindMouse ( " L2" , devMouse + " :Middle" ) ); // Nunchuk shake Z
14191431
1420- wmButtons->SetControlExpression (0 , " A | ` " + devMouse + " :Left` " ); // A
1421- wmButtons->SetControlExpression (1 , " B | ` " + devMouse + " :Right` " ); // B
1432+ wmButtons->SetControlExpression (0 , bindMouse ( " A " , devMouse + " :Left" ) ); // A
1433+ wmButtons->SetControlExpression (1 , bindMouse ( " B " , devMouse + " :Right" ) ); // B
14221434 wmButtons->SetControlExpression (2 , " Start" ); // 1
14231435 wmButtons->SetControlExpression (3 , " Select" ); // 2
14241436 wmButtons->SetControlExpression (4 , " L" ); // -
@@ -1430,8 +1442,8 @@ void retro_set_controller_port_device_wii(unsigned port, unsigned device)
14301442 {
14311443 if (device == RETRO_DEVICE_WIIMOTE )
14321444 {
1433- wmButtons->SetControlExpression (0 , " A | ` " + devMouse + " :Left` " ); // A
1434- wmButtons->SetControlExpression (1 , " B | ` " + devMouse + " :Right` " ); // B
1445+ wmButtons->SetControlExpression (0 , bindMouse ( " A " , devMouse + " :Left" ) ); // A
1446+ wmButtons->SetControlExpression (1 , bindMouse ( " B " , devMouse + " :Right" ) ); // B
14351447 wmButtons->SetControlExpression (2 , " X" ); // 1
14361448 wmButtons->SetControlExpression (3 , " Y" ); // 2
14371449 }
@@ -1506,9 +1518,9 @@ void retro_set_controller_port_device_wii(unsigned port, unsigned device)
15061518 f.sideways = true ;
15071519 Libretro::Input::UpdateWiimoteMappings (f, port, device);
15081520
1509- wmShake->SetControlExpression (0 , " R2 | ` " + devMouse + " :Middle` " ); // Wiimote shake X
1510- wmShake->SetControlExpression (1 , " R2 | ` " + devMouse + " :Middle` " ); // Wiimote shake Y
1511- wmShake->SetControlExpression (2 , " R2 | ` " + devMouse + " :Middle` " ); // Wiimote shake Z
1521+ wmShake->SetControlExpression (0 , bindMouse ( " L2 " , devMouse + " :Middle" ) ); // Wiimote shake X
1522+ wmShake->SetControlExpression (1 , bindMouse ( " L2 " , devMouse + " :Middle" ) ); // Wiimote shake Y
1523+ wmShake->SetControlExpression (2 , bindMouse ( " L2 " , devMouse + " :Middle" ) ); // Wiimote shake Z
15121524 }
15131525
15141526 ControllerEmu::ControlGroup* wmOptions = wm->GetWiimoteGroup (WiimoteGroup::Options);
0 commit comments