|
|
|
@ -56,6 +56,7 @@ public class ConfigureControls extends Object{ |
|
|
|
|
while (stream.available()>0) { |
|
|
|
|
Action a = Action.valueOf(readString(stream)); |
|
|
|
|
byte port = stream.readByte(); |
|
|
|
|
System.out.println("PI:"+port); |
|
|
|
|
do { |
|
|
|
|
if (port==(byte)-1) { |
|
|
|
|
int keycode = stream.readInt(); |
|
|
|
@ -63,6 +64,7 @@ public class ConfigureControls extends Object{ |
|
|
|
|
appendToKeybind(a,kb); |
|
|
|
|
} else { |
|
|
|
|
java.lang.String controllerName = readString(stream); |
|
|
|
|
System.out.println("CONT:"+controllerName); |
|
|
|
|
Controller controller=null; |
|
|
|
|
for (int i = 0; i < RabiClone.CONTROLLERS.length; i++) { |
|
|
|
|
if (RabiClone.CONTROLLERS[i].getType() == Controller.Type.KEYBOARD |
|
|
|
@ -75,11 +77,12 @@ public class ConfigureControls extends Object{ |
|
|
|
|
} |
|
|
|
|
if (controller==null) { |
|
|
|
|
//Discard these bits of data as we didn't find a controller.
|
|
|
|
|
readString(stream); |
|
|
|
|
java.lang.String comName = readString(stream); |
|
|
|
|
System.out.println("NULL:"+comName); |
|
|
|
|
stream.readFloat(); |
|
|
|
|
continue; |
|
|
|
|
} else { |
|
|
|
|
java.lang.String componentName = readString(stream); |
|
|
|
|
System.out.println("COM:"+componentName); |
|
|
|
|
Component c=null; |
|
|
|
|
for (Component cc : controller.getComponents()) { |
|
|
|
|
if (cc.getName().equals(componentName)) { |
|
|
|
@ -97,7 +100,8 @@ public class ConfigureControls extends Object{ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
port = stream.readByte(); |
|
|
|
|
} while (port!='\0'); |
|
|
|
|
System.out.println("P:"+port); |
|
|
|
|
} while (port!=(byte)-2); |
|
|
|
|
} |
|
|
|
|
updateHighlightSections(); |
|
|
|
|
} catch (IOException e) { |
|
|
|
@ -130,16 +134,18 @@ public class ConfigureControls extends Object{ |
|
|
|
|
for (Action a : Action.values()) { |
|
|
|
|
writeString(a.name(),stream); |
|
|
|
|
for (KeyBind k : KeyBind.KEYBINDS.get(a)) { |
|
|
|
|
stream.writeByte(k.port); |
|
|
|
|
if (k.port==(byte)-1) { |
|
|
|
|
stream.writeInt(((Key)k.id).getKeyCode()); |
|
|
|
|
} else { |
|
|
|
|
writeString(RabiClone.CONTROLLERS[k.port].getName(),stream); |
|
|
|
|
writeString(RabiClone.CONTROLLERS[k.port].getComponent(k.id).getName(),stream); |
|
|
|
|
stream.writeFloat(k.getVal()); |
|
|
|
|
if (k.port==-1||k.port<RabiClone.CONTROLLERS.length) { |
|
|
|
|
stream.writeByte(k.port); |
|
|
|
|
if (k.port==(byte)-1) { |
|
|
|
|
stream.writeInt(((Key)k.id).getKeyCode()); |
|
|
|
|
} else { |
|
|
|
|
writeString(RabiClone.CONTROLLERS[k.port].getName(),stream); |
|
|
|
|
writeString(RabiClone.CONTROLLERS[k.port].getComponent(k.id).getName(),stream); |
|
|
|
|
stream.writeFloat(k.getVal()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
stream.writeByte('\0'); |
|
|
|
|
stream.writeByte((byte)-2); |
|
|
|
|
} |
|
|
|
|
stream.close(); |
|
|
|
|
} catch (IOException e) { |
|
|
|
@ -152,7 +158,7 @@ public class ConfigureControls extends Object{ |
|
|
|
|
stream.writeChar('\0'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void updateHighlightSections() { |
|
|
|
|
public static void updateHighlightSections() { |
|
|
|
|
for (int i=0;i<Action.values().length;i++) { |
|
|
|
|
Action a = Action.values()[i]; |
|
|
|
|
actionHighlightSections.add(new ArrayList<Integer>()); |
|
|
|
|