Commits

Anonymous committed 5276e17

- Outputs detected JInput devices (an empty list if JInput libraries aren't working)
- Case insensitive controller name detection (possible cause of "not detected" message?)

Comments (0)

Files changed (4)

src/com/joshjcarrier/minecontrol/App.java

  */
 public class App {
 
-	public static String VERSION = "1.0.0";
+	public static String VERSION = "1.0.1";
 	
 	/**
 	 * @param args

src/com/joshjcarrier/minecontrol/controller/ControllerManager.java

 
 import net.java.games.input.Component;
 import net.java.games.input.Controller;
+import net.java.games.input.ControllerEnvironment;
 import net.java.games.input.Event;
 import net.java.games.input.EventQueue;
 
 		tristateSuppression = new HashMap<String, Integer>();
 	}
 	
+	public String getControllers()
+	{
+		Controller[] ca = ControllerEnvironment.getDefaultEnvironment().getControllers();
+		 String detectedControllers = "";
+		for(Controller controller : ca)
+		{
+		    /* Get the name of the controller */
+		    detectedControllers += controller.getName() + " (" + controller.getType() + ")\n";
+		}
+		
+		return detectedControllers;
+	}
+	
 	public void setController(ControllerPlugin controller)
 	{
 		this.eventMapping = controller.getActionMapping();

src/com/joshjcarrier/minecontrol/controller/mapping/ControllerPlugin.java

 
 		for (int i = 0; i < ca.length; i++) {
 		
-			if (ca[i].getName().contains(getInputRegistrationMatching())) {
+			if (ca[i].getName().toLowerCase().contains(getInputRegistrationMatching().toLowerCase())) {
 				System.out.println(ca[i] + " controller detected.");
 				return ca[i];
 			}

src/com/joshjcarrier/minecontrol/ui/ConfigurationManager.java

 import java.awt.GridLayout;
 import java.awt.Point;
 import java.awt.event.ActionEvent;
-import java.net.URL;
 import java.util.HashMap;
 
 import javax.swing.ImageIcon;
 		}
 		else
 		{
-			JOptionPane.showMessageDialog(configWindow, "Controller not found. Connect the joystick and restart Minecontrol.");
+			String controllerList = joystickControllerManager.getControllers();
+			JOptionPane.showMessageDialog(configWindow, "Controller not found. Connect the joystick and restart Minecontrol.\nDetected input devices:\n" + controllerList);
 		}
 	}
 	
 		window.setPreferredSize(new Dimension(300, 620));
 		window.add(buildCreditsPanel(), BorderLayout.NORTH);
 		window.add(buildControlPanel(), BorderLayout.CENTER);
-		window.add(new JLabel("v" + App.VERSION + ". 2010 Josh Carrier <josh@joshjcarrier.com>"), BorderLayout.SOUTH);
+		window.add(new JLabel("v" + App.VERSION + ". 2011 Josh Carrier <josh@joshjcarrier.com>"), BorderLayout.SOUTH);
 		
 		window.pack();
 		window.setResizable(false);