mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-11 14:30:08 +00:00
Correctly handle shifted keys in JSON touch keypad joystick and simplify associated JSON preferences
This commit is contained in:
parent
2878c5adde
commit
c98777c6ae
@ -25,6 +25,7 @@ import java.util.ArrayList;
|
||||
import org.deadc0de.apple2ix.basic.R;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class Apple2KeypadChooser implements Apple2MenuView {
|
||||
|
||||
@ -50,6 +51,36 @@ public class Apple2KeypadChooser implements Apple2MenuView {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isShiftedKey(char ascii) {
|
||||
switch (ascii) {
|
||||
case '~':
|
||||
case '!':
|
||||
case '@':
|
||||
case '#':
|
||||
case '$':
|
||||
case '%':
|
||||
case '^':
|
||||
case '&':
|
||||
case '*':
|
||||
case '(':
|
||||
case ')':
|
||||
case '_':
|
||||
case '+':
|
||||
case '{':
|
||||
case '}':
|
||||
case '|':
|
||||
case ':':
|
||||
case '"':
|
||||
case '<':
|
||||
case '>':
|
||||
case '?':
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void onKeyTapCalibrationEvent(char ascii, int scancode) {
|
||||
if (ascii == Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION) {
|
||||
scancode = -1;
|
||||
@ -63,7 +94,8 @@ public class Apple2KeypadChooser implements Apple2MenuView {
|
||||
if (ascii == ' ') {
|
||||
ascii = Apple2KeyboardSettingsMenu.ICONTEXT_VISUAL_SPACE;
|
||||
}
|
||||
mChooserState.setKey(mActivity, ascii, scancode);
|
||||
Apple2KeypadSettingsMenu.KeyTuple tuple = new Apple2KeypadSettingsMenu.KeyTuple((long) ascii, (long) scancode, isShiftedKey(ascii));
|
||||
mChooserState.setKey(mActivity, tuple);
|
||||
Apple2Preferences.setJSONPref(Apple2SettingsMenu.SETTINGS.CURRENT_INPUT, Apple2SettingsMenu.TouchDeviceVariant.JOYSTICK_KEYPAD.ordinal());
|
||||
Apple2Preferences.sync(mActivity, Apple2Preferences.PREF_DOMAIN_TOUCHSCREEN);
|
||||
|
||||
@ -313,23 +345,19 @@ public class Apple2KeypadChooser implements Apple2MenuView {
|
||||
|
||||
public static final int size = STATE_MACHINE.values().length;
|
||||
|
||||
private static ArrayList<String> axisChars = new ArrayList<String>();
|
||||
private static ArrayList<String> axisScans = new ArrayList<String>();
|
||||
private static ArrayList<String> buttChars = new ArrayList<String>();
|
||||
private static ArrayList<String> buttScans = new ArrayList<String>();
|
||||
private static ArrayList<Apple2KeypadSettingsMenu.KeyTuple> axisRosette = new ArrayList<Apple2KeypadSettingsMenu.KeyTuple>();
|
||||
private static ArrayList<Apple2KeypadSettingsMenu.KeyTuple> buttRosette = new ArrayList<Apple2KeypadSettingsMenu.KeyTuple>();
|
||||
|
||||
public void setKey(Apple2Activity activity, int ascii, int scancode) {
|
||||
public void setKey(Apple2Activity activity, Apple2KeypadSettingsMenu.KeyTuple tuple) {
|
||||
int ord = ordinal();
|
||||
int buttbegin = CHOOSE_BUTT_NORTHWEST.ordinal();
|
||||
if (ord < buttbegin) {
|
||||
axisChars.set(ord, "" + ascii);
|
||||
axisScans.set(ord, "" + scancode);
|
||||
Apple2KeypadSettingsMenu.KeypadPreset.saveAxisRosettes(axisChars, axisScans);
|
||||
axisRosette.set(ord, tuple);
|
||||
Apple2KeypadSettingsMenu.KeypadPreset.saveAxisRosette(axisRosette);
|
||||
} else {
|
||||
ord -= buttbegin;
|
||||
buttChars.set(ord, "" + ascii);
|
||||
buttScans.set(ord, "" + scancode);
|
||||
Apple2KeypadSettingsMenu.KeypadPreset.saveButtRosettes(buttChars, buttScans);
|
||||
buttRosette.set(ord, tuple);
|
||||
Apple2KeypadSettingsMenu.KeypadPreset.saveButtRosette(buttRosette);
|
||||
}
|
||||
Apple2Preferences.sync(activity, Apple2Preferences.PREF_DOMAIN_JOYSTICK);
|
||||
}
|
||||
@ -337,47 +365,44 @@ public class Apple2KeypadChooser implements Apple2MenuView {
|
||||
public abstract String getKeyName(Apple2Activity activity);
|
||||
|
||||
public void start() {
|
||||
setupCharsAndScans(axisChars, axisScans, Apple2KeypadSettingsMenu.PREF_KPAD_AXIS_ROSETTE_CHAR_ARRAY, Apple2KeypadSettingsMenu.PREF_KPAD_AXIS_ROSETTE_SCAN_ARRAY);
|
||||
setupCharsAndScans(axisRosette, Apple2KeypadSettingsMenu.PREF_KPAD_AXIS_ROSETTE);
|
||||
|
||||
setupCharsAndScans(buttChars, buttScans, Apple2KeypadSettingsMenu.PREF_KPAD_BUTT_ROSETTE_CHAR_ARRAY, Apple2KeypadSettingsMenu.PREF_KPAD_BUTT_ROSETTE_SCAN_ARRAY);
|
||||
setupCharsAndScans(buttRosette, Apple2KeypadSettingsMenu.PREF_KPAD_BUTT_ROSETTE);
|
||||
}
|
||||
|
||||
private void setupCharsAndScans(final ArrayList<String> chars, final ArrayList<String> scans, final String charArrayPref, final String scanArrayPref) {
|
||||
chars.clear();
|
||||
scans.clear();
|
||||
|
||||
JSONArray jsonChars = (JSONArray) Apple2Preferences.getJSONPref(Apple2Preferences.PREF_DOMAIN_JOYSTICK, charArrayPref, null);
|
||||
JSONArray jsonScans = (JSONArray) Apple2Preferences.getJSONPref(Apple2Preferences.PREF_DOMAIN_JOYSTICK, scanArrayPref, null);
|
||||
|
||||
if (jsonChars == null || jsonScans == null) {
|
||||
jsonChars = new JSONArray();
|
||||
jsonScans = new JSONArray();
|
||||
for (int i = 0; i < Apple2KeypadSettingsMenu.ROSETTE_SIZE; i++) {
|
||||
jsonChars.put(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION);
|
||||
jsonScans.put(-1);
|
||||
}
|
||||
}
|
||||
|
||||
int len = jsonChars.length();
|
||||
if (len != Apple2KeypadSettingsMenu.ROSETTE_SIZE) {
|
||||
throw new RuntimeException("jsonChars not expected length");
|
||||
}
|
||||
if (len != jsonScans.length()) {
|
||||
throw new RuntimeException("jsonScans not expected length");
|
||||
}
|
||||
private void setupCharsAndScans(final ArrayList<Apple2KeypadSettingsMenu.KeyTuple> rosette, final String pref) {
|
||||
rosette.clear();
|
||||
|
||||
try {
|
||||
JSONArray jsonArray = (JSONArray) Apple2Preferences.getJSONPref(Apple2Preferences.PREF_DOMAIN_JOYSTICK, pref, null);
|
||||
|
||||
if (jsonArray == null) {
|
||||
jsonArray = new JSONArray();
|
||||
for (int i = 0; i < Apple2KeypadSettingsMenu.ROSETTE_SIZE; i++) {
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("ch", (long) Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION);
|
||||
map.put("scan", -1L);
|
||||
map.put("isShifted", false);
|
||||
}
|
||||
}
|
||||
|
||||
int len = jsonArray.length();
|
||||
if (len != Apple2KeypadSettingsMenu.ROSETTE_SIZE) {
|
||||
throw new RuntimeException("rosette not expected length");
|
||||
}
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
Apple2KeypadSettingsMenu.KeypadPreset.addRosetteKey(chars, scans, jsonChars.getInt(i), jsonScans.getInt(i));
|
||||
JSONObject obj = jsonArray.getJSONObject(i);
|
||||
long ch = obj.getLong("ch");
|
||||
long scan = obj.getLong("scan");
|
||||
boolean isShifted = obj.getBoolean("isShifted");
|
||||
rosette.add(new Apple2KeypadSettingsMenu.KeyTuple(ch, scan, isShifted));
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (chars.size() != Apple2KeypadSettingsMenu.ROSETTE_SIZE) {
|
||||
throw new RuntimeException("rosette chars is not correct size");
|
||||
}
|
||||
if (scans.size() != Apple2KeypadSettingsMenu.ROSETTE_SIZE) {
|
||||
if (rosette.size() != Apple2KeypadSettingsMenu.ROSETTE_SIZE) {
|
||||
throw new RuntimeException("rosette chars is not correct size");
|
||||
}
|
||||
}
|
||||
|
@ -20,15 +20,14 @@ import java.util.ArrayList;
|
||||
|
||||
import org.deadc0de.apple2ix.basic.R;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class Apple2KeypadSettingsMenu extends Apple2AbstractMenu {
|
||||
|
||||
private final static String TAG = "Apple2KeypadSettingsMenu";
|
||||
|
||||
public final static String PREF_KPAD_AXIS_ROSETTE_CHAR_ARRAY = "kpAxisRosetteChars";
|
||||
public final static String PREF_KPAD_AXIS_ROSETTE_SCAN_ARRAY = "kpAxisRosetteScancodes";
|
||||
public final static String PREF_KPAD_BUTT_ROSETTE_CHAR_ARRAY = "kpButtRosetteChars";
|
||||
public final static String PREF_KPAD_BUTT_ROSETTE_SCAN_ARRAY = "kpButtRosetteScancodes";
|
||||
public final static String PREF_KPAD_AXIS_ROSETTE = "kpAxisRosette";
|
||||
public final static String PREF_KPAD_BUTT_ROSETTE = "kpButtRosette";
|
||||
|
||||
public final static int ROSETTE_SIZE = 9;
|
||||
|
||||
@ -59,6 +58,22 @@ public class Apple2KeypadSettingsMenu extends Apple2AbstractMenu {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static class KeyTuple {
|
||||
public long ch;
|
||||
public long scan;
|
||||
public boolean isShifted;
|
||||
|
||||
public KeyTuple(long ch, long scan) {
|
||||
this(ch, scan, false);
|
||||
}
|
||||
|
||||
public KeyTuple(long ch, long scan, boolean isShifted) {
|
||||
this.ch = ch;
|
||||
this.scan = scan;
|
||||
this.isShifted = isShifted;
|
||||
}
|
||||
}
|
||||
|
||||
public enum KeypadPreset {
|
||||
ARROWS_SPACE {
|
||||
@Override
|
||||
@ -69,37 +84,35 @@ public class Apple2KeypadSettingsMenu extends Apple2AbstractMenu {
|
||||
@Override
|
||||
public void apply(Apple2Activity activity) {
|
||||
{
|
||||
ArrayList<String> chars = new ArrayList<String>();
|
||||
ArrayList<String> scans = new ArrayList<String>();
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.MOUSETEXT_UP, Apple2KeyboardSettingsMenu.SCANCODE_UP);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
ArrayList<KeyTuple> axisRosette = new ArrayList<KeyTuple>();
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.MOUSETEXT_UP, Apple2KeyboardSettingsMenu.SCANCODE_UP));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.MOUSETEXT_LEFT, Apple2KeyboardSettingsMenu.SCANCODE_LEFT);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.MOUSETEXT_RIGHT, Apple2KeyboardSettingsMenu.SCANCODE_RIGHT);
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.MOUSETEXT_LEFT, Apple2KeyboardSettingsMenu.SCANCODE_LEFT));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.MOUSETEXT_RIGHT, Apple2KeyboardSettingsMenu.SCANCODE_RIGHT));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.MOUSETEXT_DOWN, Apple2KeyboardSettingsMenu.SCANCODE_DOWN);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
saveAxisRosettes(chars, scans);
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.MOUSETEXT_DOWN, Apple2KeyboardSettingsMenu.SCANCODE_DOWN));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
saveAxisRosette(axisRosette);
|
||||
}
|
||||
|
||||
{
|
||||
ArrayList<String> chars = new ArrayList<String>();
|
||||
ArrayList<String> scans = new ArrayList<String>();
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
ArrayList<KeyTuple> buttRosette = new ArrayList<KeyTuple>();
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_VISUAL_SPACE, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_VISUAL_SPACE, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
saveButtRosettes(chars, scans);
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
saveButtRosette(buttRosette);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -112,37 +125,36 @@ public class Apple2KeypadSettingsMenu extends Apple2AbstractMenu {
|
||||
@Override
|
||||
public void apply(Apple2Activity activity) {
|
||||
{
|
||||
ArrayList<String> chars = new ArrayList<String>();
|
||||
ArrayList<String> scans = new ArrayList<String>();
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, 'A', Apple2KeyboardSettingsMenu.SCANCODE_A);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
ArrayList<KeyTuple> axisRosette = new ArrayList<KeyTuple>();
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.MOUSETEXT_LEFT, Apple2KeyboardSettingsMenu.SCANCODE_LEFT);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.MOUSETEXT_RIGHT, Apple2KeyboardSettingsMenu.SCANCODE_RIGHT);
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new KeyTuple('A', Apple2KeyboardSettingsMenu.SCANCODE_A));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, 'Z', Apple2KeyboardSettingsMenu.SCANCODE_Z);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
saveAxisRosettes(chars, scans);
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.MOUSETEXT_LEFT, Apple2KeyboardSettingsMenu.SCANCODE_LEFT));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.MOUSETEXT_RIGHT, Apple2KeyboardSettingsMenu.SCANCODE_RIGHT));
|
||||
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new KeyTuple('Z', Apple2KeyboardSettingsMenu.SCANCODE_Z));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
saveAxisRosette(axisRosette);
|
||||
}
|
||||
|
||||
{
|
||||
ArrayList<String> chars = new ArrayList<String>();
|
||||
ArrayList<String> scans = new ArrayList<String>();
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
ArrayList<KeyTuple> buttRosette = new ArrayList<KeyTuple>();
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_VISUAL_SPACE, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_VISUAL_SPACE, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
saveButtRosettes(chars, scans);
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
saveButtRosette(buttRosette);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -155,37 +167,35 @@ public class Apple2KeypadSettingsMenu extends Apple2AbstractMenu {
|
||||
@Override
|
||||
public void apply(Apple2Activity activity) {
|
||||
{
|
||||
ArrayList<String> chars = new ArrayList<String>();
|
||||
ArrayList<String> scans = new ArrayList<String>();
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_LEFT);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_RIGHT);
|
||||
ArrayList<KeyTuple> axisRosette = new ArrayList<KeyTuple>();
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_LEFT));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_RIGHT));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.MOUSETEXT_LEFT, Apple2KeyboardSettingsMenu.SCANCODE_LEFT);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.MOUSETEXT_RIGHT, Apple2KeyboardSettingsMenu.SCANCODE_RIGHT);
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.MOUSETEXT_LEFT, Apple2KeyboardSettingsMenu.SCANCODE_LEFT));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.MOUSETEXT_RIGHT, Apple2KeyboardSettingsMenu.SCANCODE_RIGHT));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_LEFT);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_RIGHT);
|
||||
saveAxisRosettes(chars, scans);
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_LEFT));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_RIGHT));
|
||||
saveAxisRosette(axisRosette);
|
||||
}
|
||||
|
||||
{
|
||||
ArrayList<String> chars = new ArrayList<String>();
|
||||
ArrayList<String> scans = new ArrayList<String>();
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
ArrayList<KeyTuple> buttRosette = new ArrayList<KeyTuple>();
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_VISUAL_SPACE, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_VISUAL_SPACE, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
saveButtRosettes(chars, scans);
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
saveButtRosette(buttRosette);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -198,36 +208,35 @@ public class Apple2KeypadSettingsMenu extends Apple2AbstractMenu {
|
||||
@Override
|
||||
public void apply(Apple2Activity activity) {
|
||||
{
|
||||
ArrayList<String> chars = new ArrayList<String>();
|
||||
ArrayList<String> scans = new ArrayList<String>();
|
||||
ArrayList<KeyTuple> axisRosette = new ArrayList<KeyTuple>();
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new KeyTuple('A', Apple2KeyboardSettingsMenu.SCANCODE_A));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, 'A', Apple2KeyboardSettingsMenu.SCANCODE_A);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.MOUSETEXT_LEFT, Apple2KeyboardSettingsMenu.SCANCODE_LEFT);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.MOUSETEXT_RIGHT, Apple2KeyboardSettingsMenu.SCANCODE_RIGHT);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, 'Z', Apple2KeyboardSettingsMenu.SCANCODE_Z);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
saveAxisRosettes(chars, scans);
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.MOUSETEXT_LEFT, Apple2KeyboardSettingsMenu.SCANCODE_LEFT));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.MOUSETEXT_RIGHT, Apple2KeyboardSettingsMenu.SCANCODE_RIGHT));
|
||||
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new KeyTuple('Z', Apple2KeyboardSettingsMenu.SCANCODE_Z));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
saveAxisRosette(axisRosette);
|
||||
}
|
||||
|
||||
{
|
||||
ArrayList<String> chars = new ArrayList<String>();
|
||||
ArrayList<String> scans = new ArrayList<String>();
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_Q);
|
||||
addRosetteKey(chars, scans, 'Q', Apple2KeyboardSettingsMenu.SCANCODE_Q);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_Q);
|
||||
ArrayList<KeyTuple> buttRosette = new ArrayList<KeyTuple>();
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_Q));
|
||||
buttRosette.add(new KeyTuple('Q', Apple2KeyboardSettingsMenu.SCANCODE_Q));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_Q));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_VISUAL_SPACE, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_VISUAL_SPACE, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
saveButtRosettes(chars, scans);
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
saveButtRosette(buttRosette);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -240,37 +249,35 @@ public class Apple2KeypadSettingsMenu extends Apple2AbstractMenu {
|
||||
@Override
|
||||
public void apply(Apple2Activity activity) {
|
||||
{
|
||||
ArrayList<String> chars = new ArrayList<String>();
|
||||
ArrayList<String> scans = new ArrayList<String>();
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, 'I', Apple2KeyboardSettingsMenu.SCANCODE_I);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
ArrayList<KeyTuple> axisRosette = new ArrayList<KeyTuple>();
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new KeyTuple('I', Apple2KeyboardSettingsMenu.SCANCODE_I));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
|
||||
addRosetteKey(chars, scans, 'J', Apple2KeyboardSettingsMenu.SCANCODE_J);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, 'K', Apple2KeyboardSettingsMenu.SCANCODE_K);
|
||||
axisRosette.add(new KeyTuple('J', Apple2KeyboardSettingsMenu.SCANCODE_J));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new KeyTuple('K', Apple2KeyboardSettingsMenu.SCANCODE_K));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, 'M', Apple2KeyboardSettingsMenu.SCANCODE_M);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
saveAxisRosettes(chars, scans);
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new KeyTuple('M', Apple2KeyboardSettingsMenu.SCANCODE_M));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
saveAxisRosette(axisRosette);
|
||||
}
|
||||
|
||||
{
|
||||
ArrayList<String> chars = new ArrayList<String>();
|
||||
ArrayList<String> scans = new ArrayList<String>();
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
ArrayList<KeyTuple> buttRosette = new ArrayList<KeyTuple>();
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_VISUAL_SPACE, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_VISUAL_SPACE, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
saveButtRosettes(chars, scans);
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
saveButtRosette(buttRosette);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -283,37 +290,35 @@ public class Apple2KeypadSettingsMenu extends Apple2AbstractMenu {
|
||||
@Override
|
||||
public void apply(Apple2Activity activity) {
|
||||
{
|
||||
ArrayList<String> chars = new ArrayList<String>();
|
||||
ArrayList<String> scans = new ArrayList<String>();
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, 'W', Apple2KeyboardSettingsMenu.SCANCODE_W);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
ArrayList<KeyTuple> axisRosette = new ArrayList<KeyTuple>();
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new KeyTuple('W', Apple2KeyboardSettingsMenu.SCANCODE_W));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
|
||||
addRosetteKey(chars, scans, 'A', Apple2KeyboardSettingsMenu.SCANCODE_A);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, 'D', Apple2KeyboardSettingsMenu.SCANCODE_D);
|
||||
axisRosette.add(new KeyTuple('A', Apple2KeyboardSettingsMenu.SCANCODE_A));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new KeyTuple('D', Apple2KeyboardSettingsMenu.SCANCODE_D));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, 'X', Apple2KeyboardSettingsMenu.SCANCODE_X);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
saveAxisRosettes(chars, scans);
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new KeyTuple('X', Apple2KeyboardSettingsMenu.SCANCODE_X));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
saveAxisRosette(axisRosette);
|
||||
}
|
||||
|
||||
{
|
||||
ArrayList<String> chars = new ArrayList<String>();
|
||||
ArrayList<String> scans = new ArrayList<String>();
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
ArrayList<KeyTuple> buttRosette = new ArrayList<KeyTuple>();
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_VISUAL_SPACE, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_VISUAL_SPACE, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
saveButtRosettes(chars, scans);
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
saveButtRosette(buttRosette);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -331,37 +336,35 @@ public class Apple2KeypadSettingsMenu extends Apple2AbstractMenu {
|
||||
@Override
|
||||
public void apply(Apple2Activity activity) {
|
||||
{
|
||||
ArrayList<String> chars = new ArrayList<String>();
|
||||
ArrayList<String> scans = new ArrayList<String>();
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, 'I', Apple2KeyboardSettingsMenu.SCANCODE_I);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
ArrayList<KeyTuple> axisRosette = new ArrayList<KeyTuple>();
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new KeyTuple('I', Apple2KeyboardSettingsMenu.SCANCODE_I));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
|
||||
addRosetteKey(chars, scans, 'J', Apple2KeyboardSettingsMenu.SCANCODE_J);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_VISUAL_SPACE, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, 'L', Apple2KeyboardSettingsMenu.SCANCODE_L);
|
||||
axisRosette.add(new KeyTuple('J', Apple2KeyboardSettingsMenu.SCANCODE_J));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_VISUAL_SPACE, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
axisRosette.add(new KeyTuple('L', Apple2KeyboardSettingsMenu.SCANCODE_L));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, 'K', Apple2KeyboardSettingsMenu.SCANCODE_K);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
saveAxisRosettes(chars, scans);
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new KeyTuple('K', Apple2KeyboardSettingsMenu.SCANCODE_K));
|
||||
axisRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
saveAxisRosette(axisRosette);
|
||||
}
|
||||
|
||||
{
|
||||
ArrayList<String> chars = new ArrayList<String>();
|
||||
ArrayList<String> scans = new ArrayList<String>();
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_U);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_O);
|
||||
ArrayList<KeyTuple> buttRosette = new ArrayList<KeyTuple>();
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_U));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_O));
|
||||
|
||||
addRosetteKey(chars, scans, 'U', Apple2KeyboardSettingsMenu.SCANCODE_U);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, 'O', Apple2KeyboardSettingsMenu.SCANCODE_O);
|
||||
buttRosette.add(new KeyTuple('U', Apple2KeyboardSettingsMenu.SCANCODE_U));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
buttRosette.add(new KeyTuple('O', Apple2KeyboardSettingsMenu.SCANCODE_O));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_U);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_O);
|
||||
saveButtRosettes(chars, scans);
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_U));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_O));
|
||||
saveButtRosette(buttRosette);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -374,37 +377,35 @@ public class Apple2KeypadSettingsMenu extends Apple2AbstractMenu {
|
||||
@Override
|
||||
public void apply(Apple2Activity activity) {
|
||||
{
|
||||
ArrayList<String> chars = new ArrayList<String>();
|
||||
ArrayList<String> scans = new ArrayList<String>();
|
||||
addRosetteKey(chars, scans, 'Q', Apple2KeyboardSettingsMenu.SCANCODE_Q);
|
||||
addRosetteKey(chars, scans, 'W', Apple2KeyboardSettingsMenu.SCANCODE_W);
|
||||
addRosetteKey(chars, scans, 'E', Apple2KeyboardSettingsMenu.SCANCODE_E);
|
||||
ArrayList<KeyTuple> axisRosette = new ArrayList<KeyTuple>();
|
||||
axisRosette.add(new KeyTuple('Q', Apple2KeyboardSettingsMenu.SCANCODE_Q));
|
||||
axisRosette.add(new KeyTuple('W', Apple2KeyboardSettingsMenu.SCANCODE_W));
|
||||
axisRosette.add(new KeyTuple('E', Apple2KeyboardSettingsMenu.SCANCODE_E));
|
||||
|
||||
addRosetteKey(chars, scans, 'A', Apple2KeyboardSettingsMenu.SCANCODE_A);
|
||||
addRosetteKey(chars, scans, 'S', Apple2KeyboardSettingsMenu.SCANCODE_S);
|
||||
addRosetteKey(chars, scans, 'D', Apple2KeyboardSettingsMenu.SCANCODE_D);
|
||||
axisRosette.add(new KeyTuple('A', Apple2KeyboardSettingsMenu.SCANCODE_A));
|
||||
axisRosette.add(new KeyTuple('S', Apple2KeyboardSettingsMenu.SCANCODE_S));
|
||||
axisRosette.add(new KeyTuple('D', Apple2KeyboardSettingsMenu.SCANCODE_D));
|
||||
|
||||
addRosetteKey(chars, scans, 'Z', Apple2KeyboardSettingsMenu.SCANCODE_Z);
|
||||
addRosetteKey(chars, scans, 'X', Apple2KeyboardSettingsMenu.SCANCODE_X);
|
||||
addRosetteKey(chars, scans, 'C', Apple2KeyboardSettingsMenu.SCANCODE_C);
|
||||
saveAxisRosettes(chars, scans);
|
||||
axisRosette.add(new KeyTuple('Z', Apple2KeyboardSettingsMenu.SCANCODE_Z));
|
||||
axisRosette.add(new KeyTuple('X', Apple2KeyboardSettingsMenu.SCANCODE_X));
|
||||
axisRosette.add(new KeyTuple('C', Apple2KeyboardSettingsMenu.SCANCODE_C));
|
||||
saveAxisRosette(axisRosette);
|
||||
}
|
||||
|
||||
{
|
||||
ArrayList<String> chars = new ArrayList<String>();
|
||||
ArrayList<String> scans = new ArrayList<String>();
|
||||
addRosetteKey(chars, scans, 'I', Apple2KeyboardSettingsMenu.SCANCODE_I);
|
||||
addRosetteKey(chars, scans, 'O', Apple2KeyboardSettingsMenu.SCANCODE_O);
|
||||
addRosetteKey(chars, scans, 'P', Apple2KeyboardSettingsMenu.SCANCODE_P);
|
||||
ArrayList<KeyTuple> buttRosette = new ArrayList<KeyTuple>();
|
||||
buttRosette.add(new KeyTuple('I', Apple2KeyboardSettingsMenu.SCANCODE_I));
|
||||
buttRosette.add(new KeyTuple('O', Apple2KeyboardSettingsMenu.SCANCODE_O));
|
||||
buttRosette.add(new KeyTuple('P', Apple2KeyboardSettingsMenu.SCANCODE_P));
|
||||
|
||||
addRosetteKey(chars, scans, 'K', Apple2KeyboardSettingsMenu.SCANCODE_K);
|
||||
addRosetteKey(chars, scans, 'L', Apple2KeyboardSettingsMenu.SCANCODE_L);
|
||||
addRosetteKey(chars, scans, ';', Apple2KeyboardSettingsMenu.SCANCODE_SEMICOLON);
|
||||
buttRosette.add(new KeyTuple('K', Apple2KeyboardSettingsMenu.SCANCODE_K));
|
||||
buttRosette.add(new KeyTuple('L', Apple2KeyboardSettingsMenu.SCANCODE_L));
|
||||
buttRosette.add(new KeyTuple(';', Apple2KeyboardSettingsMenu.SCANCODE_SEMICOLON));
|
||||
|
||||
addRosetteKey(chars, scans, ',', Apple2KeyboardSettingsMenu.SCANCODE_COMMA);
|
||||
addRosetteKey(chars, scans, '.', Apple2KeyboardSettingsMenu.SCANCODE_PERIOD);
|
||||
addRosetteKey(chars, scans, '/', Apple2KeyboardSettingsMenu.SCANCODE_SLASH);
|
||||
saveButtRosettes(chars, scans);
|
||||
buttRosette.add(new KeyTuple(',', Apple2KeyboardSettingsMenu.SCANCODE_COMMA));
|
||||
buttRosette.add(new KeyTuple('.', Apple2KeyboardSettingsMenu.SCANCODE_PERIOD));
|
||||
buttRosette.add(new KeyTuple('/', Apple2KeyboardSettingsMenu.SCANCODE_SLASH));
|
||||
saveButtRosette(buttRosette);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -417,66 +418,67 @@ public class Apple2KeypadSettingsMenu extends Apple2AbstractMenu {
|
||||
@Override
|
||||
public void apply(Apple2Activity activity) {
|
||||
{
|
||||
ArrayList<String> chars = new ArrayList<String>();
|
||||
ArrayList<String> scans = new ArrayList<String>();
|
||||
addRosetteKey(chars, scans, 'Y', Apple2KeyboardSettingsMenu.SCANCODE_Y);
|
||||
addRosetteKey(chars, scans, 'U', Apple2KeyboardSettingsMenu.SCANCODE_U);
|
||||
addRosetteKey(chars, scans, 'I', Apple2KeyboardSettingsMenu.SCANCODE_I);
|
||||
ArrayList<KeyTuple> axisRosette = new ArrayList<KeyTuple>();
|
||||
axisRosette.add(new KeyTuple('Y', Apple2KeyboardSettingsMenu.SCANCODE_Y));
|
||||
axisRosette.add(new KeyTuple('U', Apple2KeyboardSettingsMenu.SCANCODE_U));
|
||||
axisRosette.add(new KeyTuple('I', Apple2KeyboardSettingsMenu.SCANCODE_I));
|
||||
|
||||
addRosetteKey(chars, scans, 'H', Apple2KeyboardSettingsMenu.SCANCODE_H);
|
||||
addRosetteKey(chars, scans, 'J', Apple2KeyboardSettingsMenu.SCANCODE_J);
|
||||
addRosetteKey(chars, scans, 'K', Apple2KeyboardSettingsMenu.SCANCODE_K);
|
||||
axisRosette.add(new KeyTuple('H', Apple2KeyboardSettingsMenu.SCANCODE_H));
|
||||
axisRosette.add(new KeyTuple('J', Apple2KeyboardSettingsMenu.SCANCODE_J));
|
||||
axisRosette.add(new KeyTuple('K', Apple2KeyboardSettingsMenu.SCANCODE_K));
|
||||
|
||||
addRosetteKey(chars, scans, 'N', Apple2KeyboardSettingsMenu.SCANCODE_N);
|
||||
addRosetteKey(chars, scans, 'M', Apple2KeyboardSettingsMenu.SCANCODE_M);
|
||||
addRosetteKey(chars, scans, ',', Apple2KeyboardSettingsMenu.SCANCODE_COMMA);
|
||||
saveAxisRosettes(chars, scans);
|
||||
axisRosette.add(new KeyTuple('N', Apple2KeyboardSettingsMenu.SCANCODE_N));
|
||||
axisRosette.add(new KeyTuple('M', Apple2KeyboardSettingsMenu.SCANCODE_M));
|
||||
axisRosette.add(new KeyTuple(',', Apple2KeyboardSettingsMenu.SCANCODE_COMMA));
|
||||
saveAxisRosette(axisRosette);
|
||||
}
|
||||
|
||||
{
|
||||
ArrayList<String> chars = new ArrayList<String>();
|
||||
ArrayList<String> scans = new ArrayList<String>();
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_D);
|
||||
addRosetteKey(chars, scans, 'D', Apple2KeyboardSettingsMenu.SCANCODE_D);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_F);
|
||||
ArrayList<KeyTuple> buttRosette = new ArrayList<KeyTuple>();
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_D));
|
||||
buttRosette.add(new KeyTuple('D', Apple2KeyboardSettingsMenu.SCANCODE_D));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, Apple2KeyboardSettingsMenu.SCANCODE_F));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_VISUAL_SPACE, Apple2KeyboardSettingsMenu.SCANCODE_SPACE);
|
||||
addRosetteKey(chars, scans, 'F', Apple2KeyboardSettingsMenu.SCANCODE_F);
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_VISUAL_SPACE, Apple2KeyboardSettingsMenu.SCANCODE_SPACE));
|
||||
buttRosette.add(new KeyTuple('F', Apple2KeyboardSettingsMenu.SCANCODE_F));
|
||||
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
saveButtRosettes(chars, scans);
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
buttRosette.add(new KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
saveButtRosette(buttRosette);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public static void addRosetteKey(ArrayList<String> chars, ArrayList<String> scans, int aChar, int aScan) {
|
||||
chars.add("" + aChar);
|
||||
scans.add("" + aScan);
|
||||
public static void saveAxisRosette(ArrayList<KeyTuple> axisRosette) {
|
||||
if (axisRosette.size() != 9) {
|
||||
throw new RuntimeException("axis rosette is not correct size");
|
||||
}
|
||||
Apple2Preferences.setJSONPref(Apple2Preferences.PREF_DOMAIN_JOYSTICK, PREF_KPAD_AXIS_ROSETTE, toJSONArray(axisRosette));
|
||||
}
|
||||
|
||||
public static void saveAxisRosettes(ArrayList<String> chars, ArrayList<String> scans) {
|
||||
if (chars.size() != 9) {
|
||||
throw new RuntimeException("rosette chars is not correct size");
|
||||
public static void saveButtRosette(ArrayList<KeyTuple> buttRosette) {
|
||||
if (buttRosette.size() != 9) {
|
||||
throw new RuntimeException("butt rosette is not correct size");
|
||||
}
|
||||
if (scans.size() != 9) {
|
||||
throw new RuntimeException("rosette scans is not correct size");
|
||||
}
|
||||
Apple2Preferences.setJSONPref(Apple2Preferences.PREF_DOMAIN_JOYSTICK, PREF_KPAD_AXIS_ROSETTE_CHAR_ARRAY, new JSONArray(chars));
|
||||
Apple2Preferences.setJSONPref(Apple2Preferences.PREF_DOMAIN_JOYSTICK, PREF_KPAD_AXIS_ROSETTE_SCAN_ARRAY, new JSONArray(scans));
|
||||
Apple2Preferences.setJSONPref(Apple2Preferences.PREF_DOMAIN_JOYSTICK, PREF_KPAD_BUTT_ROSETTE, toJSONArray(buttRosette));
|
||||
}
|
||||
|
||||
public static void saveButtRosettes(ArrayList<String> chars, ArrayList<String> scans) {
|
||||
if (chars.size() != 9) {
|
||||
throw new RuntimeException("rosette chars is not correct size");
|
||||
private static JSONArray toJSONArray(ArrayList<KeyTuple> rosette) {
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
try {
|
||||
for (KeyTuple tuple : rosette) {
|
||||
JSONObject obj = new JSONObject();
|
||||
obj.put("ch", tuple.ch);
|
||||
obj.put("scan", tuple.scan);
|
||||
obj.put("isShifted", tuple.isShifted);
|
||||
jsonArray.put(obj);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (scans.size() != 9) {
|
||||
throw new RuntimeException("rosette scans is not correct size");
|
||||
}
|
||||
Apple2Preferences.setJSONPref(Apple2Preferences.PREF_DOMAIN_JOYSTICK, PREF_KPAD_BUTT_ROSETTE_CHAR_ARRAY, new JSONArray(chars));
|
||||
Apple2Preferences.setJSONPref(Apple2Preferences.PREF_DOMAIN_JOYSTICK, PREF_KPAD_BUTT_ROSETTE_SCAN_ARRAY, new JSONArray(scans));
|
||||
return jsonArray;
|
||||
}
|
||||
|
||||
public abstract String getTitle(Apple2Activity activity);
|
||||
|
@ -230,34 +230,87 @@ public class Apple2Preferences {
|
||||
setJSONPref(Apple2JoystickSettingsMenu.JoystickAdvanced.SETTINGS.JOYSTICK_TAPDELAY, framesDelay);
|
||||
}
|
||||
|
||||
// migrate axis rosette arrays to new format ...
|
||||
try {
|
||||
ArrayList<Apple2KeypadSettingsMenu.KeyTuple> axisRosette = new ArrayList<Apple2KeypadSettingsMenu.KeyTuple>();
|
||||
axisRosette.add(new Apple2KeypadSettingsMenu.KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new Apple2KeypadSettingsMenu.KeyTuple('I', Apple2KeyboardSettingsMenu.SCANCODE_I));
|
||||
axisRosette.add(new Apple2KeypadSettingsMenu.KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
|
||||
axisRosette.add(new Apple2KeypadSettingsMenu.KeyTuple('J', Apple2KeyboardSettingsMenu.SCANCODE_J));
|
||||
axisRosette.add(new Apple2KeypadSettingsMenu.KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new Apple2KeypadSettingsMenu.KeyTuple('K', Apple2KeyboardSettingsMenu.SCANCODE_K));
|
||||
|
||||
axisRosette.add(new Apple2KeypadSettingsMenu.KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
axisRosette.add(new Apple2KeypadSettingsMenu.KeyTuple('M', Apple2KeyboardSettingsMenu.SCANCODE_M));
|
||||
axisRosette.add(new Apple2KeypadSettingsMenu.KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
|
||||
JSONArray jsonArray;
|
||||
|
||||
jsonArray = (JSONArray) getJSONPref(PREF_DOMAIN_JOYSTICK, "kpAxisRosetteChars", null);
|
||||
if (jsonArray == null || jsonArray.length() != Apple2KeypadSettingsMenu.ROSETTE_SIZE) {
|
||||
Log.e(TAG, "Oops, kpAxisRosetteChars is not expected length");
|
||||
} else {
|
||||
for (int i = 0; i < Apple2KeypadSettingsMenu.ROSETTE_SIZE; i++) {
|
||||
Apple2KeypadSettingsMenu.KeyTuple tuple = axisRosette.get(i);
|
||||
tuple.ch = jsonArray.getLong(i);
|
||||
}
|
||||
}
|
||||
|
||||
jsonArray = (JSONArray) getJSONPref(PREF_DOMAIN_JOYSTICK, "kpAxisRosetteScancodes", null);
|
||||
if (jsonArray == null || jsonArray.length() != Apple2KeypadSettingsMenu.ROSETTE_SIZE) {
|
||||
Log.e(TAG, "Oops, kpAxisRosetteScancodes is not expected length");
|
||||
} else {
|
||||
for (int i = 0; i < Apple2KeypadSettingsMenu.ROSETTE_SIZE; i++) {
|
||||
Apple2KeypadSettingsMenu.KeyTuple tuple = axisRosette.get(i);
|
||||
tuple.scan = jsonArray.getLong(i);
|
||||
}
|
||||
}
|
||||
|
||||
Apple2KeypadSettingsMenu.KeypadPreset.saveAxisRosette(axisRosette);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// migrate individual keypad button actions to new button rosette actions ...
|
||||
{
|
||||
ArrayList<String> chars = new ArrayList<String>();
|
||||
ArrayList<String> scans = new ArrayList<String>();
|
||||
ArrayList<Apple2KeypadSettingsMenu.KeyTuple> buttRosette = new ArrayList<Apple2KeypadSettingsMenu.KeyTuple>();
|
||||
|
||||
int northChar = getIntJSONPref(PREF_DOMAIN_JOYSTICK, "kpSwipeNorthChar", Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION);
|
||||
int northScan = getIntJSONPref(PREF_DOMAIN_JOYSTICK, "kpSwipeNorthScancode",-1 );
|
||||
Apple2KeypadSettingsMenu.KeypadPreset.addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
Apple2KeypadSettingsMenu.KeypadPreset.addRosetteKey(chars, scans, northChar, northScan);
|
||||
Apple2KeypadSettingsMenu.KeypadPreset.addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
int northScan = getIntJSONPref(PREF_DOMAIN_JOYSTICK, "kpSwipeNorthScancode", -1);
|
||||
|
||||
int downChar = getIntJSONPref(PREF_DOMAIN_JOYSTICK, "kpTouchDownChar", Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION);
|
||||
int downScan = getIntJSONPref(PREF_DOMAIN_JOYSTICK, "kpTouchDownScancode", -1);
|
||||
Apple2KeypadSettingsMenu.KeypadPreset.addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
Apple2KeypadSettingsMenu.KeypadPreset.addRosetteKey(chars, scans, downChar, downScan);
|
||||
Apple2KeypadSettingsMenu.KeypadPreset.addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
|
||||
int southChar = getIntJSONPref(PREF_DOMAIN_JOYSTICK, "kpSwipeSouthChar", Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION);
|
||||
int southScan = getIntJSONPref(PREF_DOMAIN_JOYSTICK, "kpSwipeSouthScancode", -1);
|
||||
Apple2KeypadSettingsMenu.KeypadPreset.addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
Apple2KeypadSettingsMenu.KeypadPreset.addRosetteKey(chars, scans, southChar, southScan);
|
||||
Apple2KeypadSettingsMenu.KeypadPreset.addRosetteKey(chars, scans, Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1);
|
||||
|
||||
Apple2KeypadSettingsMenu.KeypadPreset.saveButtRosettes(chars, scans);
|
||||
if (northScan < 0 && downScan < 0 && southScan < 0) {
|
||||
downChar = Apple2KeyboardSettingsMenu.ICONTEXT_VISUAL_SPACE;
|
||||
downScan = Apple2KeyboardSettingsMenu.SCANCODE_SPACE;
|
||||
}
|
||||
|
||||
buttRosette.add(new Apple2KeypadSettingsMenu.KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
buttRosette.add(new Apple2KeypadSettingsMenu.KeyTuple(northChar, northScan));
|
||||
buttRosette.add(new Apple2KeypadSettingsMenu.KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
|
||||
buttRosette.add(new Apple2KeypadSettingsMenu.KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
buttRosette.add(new Apple2KeypadSettingsMenu.KeyTuple(downChar, downScan));
|
||||
buttRosette.add(new Apple2KeypadSettingsMenu.KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
|
||||
buttRosette.add(new Apple2KeypadSettingsMenu.KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
buttRosette.add(new Apple2KeypadSettingsMenu.KeyTuple(southChar, southScan));
|
||||
buttRosette.add(new Apple2KeypadSettingsMenu.KeyTuple(Apple2KeyboardSettingsMenu.ICONTEXT_NONACTION, -1));
|
||||
|
||||
Apple2KeypadSettingsMenu.KeypadPreset.saveButtRosette(buttRosette);
|
||||
}
|
||||
|
||||
JSONObject map = _prefDomain(PREF_DOMAIN_JOYSTICK);
|
||||
map.remove("jsTapDelaySecs");
|
||||
map.remove("kpAxisRosetteChars");
|
||||
map.remove("kpAxisRosetteScancodes");
|
||||
map.remove("kpButtRosetteChars");
|
||||
map.remove("kpButtRosetteScancodes");
|
||||
map.remove("kpSwipeNorthChar");
|
||||
map.remove("kpSwipeNorthScancode");
|
||||
map.remove("kpSwipeSouthChar");
|
||||
|
@ -34,7 +34,7 @@ int json_createFromFD(int fd, INOUT JSON_ref *jsonRef);
|
||||
// map functions
|
||||
|
||||
// returns true if JSON_ref is map collection
|
||||
bool json_isMap(const JSON_ref array);
|
||||
bool json_isMap(const JSON_ref map);
|
||||
|
||||
// get JSON_ref value for key in map JSON, returns error or tokenCount and allocated JSON_ref
|
||||
int json_mapCopyJSON(const JSON_ref map, const char *key, INOUT JSON_ref *val);
|
||||
|
@ -55,10 +55,8 @@
|
||||
#define PREF_JOY_TAP_DELAY "jsTapDelayFrames"
|
||||
#define PREF_JOY_TOUCHDOWN_CHAR "jsTouchDownChar"
|
||||
#define PREF_KPAD_FAST_AUTOREPEAT "kpFastAutoRepeat"
|
||||
#define PREF_KPAD_AXIS_ROSETTE_CHAR_ARRAY "kpAxisRosetteChars"
|
||||
#define PREF_KPAD_AXIS_ROSETTE_SCAN_ARRAY "kpAxisRosetteScancodes"
|
||||
#define PREF_KPAD_BUTT_ROSETTE_CHAR_ARRAY "kpButtRosetteChars"
|
||||
#define PREF_KPAD_BUTT_ROSETTE_SCAN_ARRAY "kpButtRosetteScancodes"
|
||||
#define PREF_KPAD_AXIS_ROSETTE "kpAxisRosette"
|
||||
#define PREF_KPAD_BUTT_ROSETTE "kpButtRosette"
|
||||
#define PREF_KPAD_SWIPE_NORTH_CHAR "kpSwipeNorthChar"
|
||||
#define PREF_KPAD_SWIPE_NORTH_SCAN "kpSwipeNorthScancode"
|
||||
#define PREF_KPAD_SWIPE_SOUTH_CHAR "kpSwipeSouthChar"
|
||||
|
@ -51,12 +51,14 @@ typedef struct subvariant_s {
|
||||
unsigned long frameCount;
|
||||
interface_touch_event_t currEventType;
|
||||
unsigned int keyPressCount;
|
||||
int scancodes[MAX_REPEATING];
|
||||
long scancodes[MAX_REPEATING];
|
||||
bool isShifted[MAX_REPEATING];
|
||||
uint8_t strobeShifter;
|
||||
|
||||
// semi-static configured rosette
|
||||
long rosetteScans[ROSETTE_ROWS * ROSETTE_COLS];
|
||||
uint8_t rosetteChars[ROSETTE_ROWS * ROSETTE_COLS];
|
||||
bool rosetteShift[ROSETTE_ROWS * ROSETTE_COLS];
|
||||
} subvariant_s;
|
||||
|
||||
static struct {
|
||||
@ -83,6 +85,8 @@ static inline void _reset_subvariant_state(subvariant_s *subvariant) {
|
||||
subvariant->autoPressIdx = REPEAT_IDX_A;
|
||||
subvariant->scancodes[REPEAT_IDX_A] = -1;
|
||||
subvariant->scancodes[REPEAT_IDX_B] = -1;
|
||||
subvariant->isShifted[REPEAT_IDX_A] = false;
|
||||
subvariant->isShifted[REPEAT_IDX_B] = false;
|
||||
subvariant->currEventType = TOUCH_UP;
|
||||
}
|
||||
|
||||
@ -92,6 +96,7 @@ static inline void _advance_press_index(keypad_press_t *idx) {
|
||||
|
||||
static inline void _press_key(subvariant_s *subvariant, keypad_press_t pressIdx) {
|
||||
int scancode = subvariant->scancodes[pressIdx];
|
||||
bool isShifted = subvariant->isShifted[pressIdx];
|
||||
|
||||
#if DEBUG_TOUCH_JOY
|
||||
{
|
||||
@ -102,9 +107,17 @@ static inline void _press_key(subvariant_s *subvariant, keypad_press_t pressIdx)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (isShifted) {
|
||||
keys_handleInput(SCODE_L_SHIFT, /*is_pressed:*/true, /*is_ascii:*/false);
|
||||
}
|
||||
|
||||
keys_handleInput(scancode, /*is_pressed:*/true, /*is_ascii:*/false);
|
||||
keys_handleInput(scancode, /*is_pressed:*/false, /*is_ascii:*/false);
|
||||
|
||||
if (isShifted) {
|
||||
keys_handleInput(SCODE_L_SHIFT, /*is_pressed:*/false, /*is_ascii:*/false);
|
||||
}
|
||||
|
||||
_advance_press_index(&subvariant->autoPressIdx);
|
||||
|
||||
++(subvariant->keyPressCount);
|
||||
@ -232,6 +245,8 @@ static void _subvariant_touchDown(subvariant_s *subvariant) {
|
||||
|
||||
subvariant->scancodes[REPEAT_IDX_A] = subvariant->rosetteScans[ROSETTE_CENTER];
|
||||
subvariant->scancodes[REPEAT_IDX_B] = -1;
|
||||
subvariant->isShifted[REPEAT_IDX_A] = subvariant->rosetteShift[ROSETTE_CENTER];
|
||||
subvariant->isShifted[REPEAT_IDX_B] = false;
|
||||
|
||||
if (joyglobals.tapDelayFrames == 0) {
|
||||
// unambiguous intent : no tap delay
|
||||
@ -258,6 +273,8 @@ static void _subvariant_touchMove(subvariant_s *subvariant, int dx, int dy, bool
|
||||
subvariant->currentOctant = ORIGIN;
|
||||
subvariant->scancodes[REPEAT_IDX_A] = subvariant->rosetteScans[ROSETTE_CENTER];
|
||||
subvariant->scancodes[REPEAT_IDX_B] = -1;
|
||||
subvariant->isShifted[REPEAT_IDX_A] = subvariant->rosetteShift[ROSETTE_CENTER];
|
||||
subvariant->isShifted[REPEAT_IDX_B] = -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -290,15 +307,21 @@ static void _subvariant_touchMove(subvariant_s *subvariant, int dx, int dy, bool
|
||||
|
||||
long scanA = -1;
|
||||
long scanB = -1;
|
||||
bool shifA = false;
|
||||
bool shifB = false;
|
||||
|
||||
switch (subvariant->currentOctant) {
|
||||
case OCTANT_NORTHWEST:
|
||||
if (subvariant->rosetteScans[ROSETTE_NORTHWEST] >= 0) {
|
||||
TOUCH_JOY_LOG("\t\tXY : NORTHWEST, (%ld)", subvariant->rosetteScans[ROSETTE_WEST]);
|
||||
scanA = subvariant->rosetteScans[ROSETTE_NORTHWEST];
|
||||
shifA = subvariant->rosetteShift[ROSETTE_NORTHWEST];
|
||||
} else {
|
||||
TOUCH_JOY_LOG("\t\tXY : WEST (%ld) & NORTH (%ld)", subvariant->rosetteScans[ROSETTE_WEST], subvariant->rosetteScans[ROSETTE_NORTH]);
|
||||
scanA = subvariant->rosetteScans[ROSETTE_WEST];
|
||||
shifA = subvariant->rosetteShift[ROSETTE_WEST];
|
||||
scanB = subvariant->rosetteScans[ROSETTE_NORTH];
|
||||
shifB = subvariant->rosetteShift[ROSETTE_NORTH];
|
||||
}
|
||||
break;
|
||||
|
||||
@ -306,12 +329,15 @@ static void _subvariant_touchMove(subvariant_s *subvariant, int dx, int dy, bool
|
||||
if (subvariant->rosetteScans[ROSETTE_NORTH] >= 0) {
|
||||
TOUCH_JOY_LOG("\t\tY : NORTH (%ld)", subvariant->rosetteScans[ROSETTE_NORTH]);
|
||||
scanA = subvariant->rosetteScans[ROSETTE_NORTH];
|
||||
shifA = subvariant->rosetteShift[ROSETTE_NORTH];
|
||||
} else if (radians < RADIANS_NORTH) {
|
||||
TOUCH_JOY_LOG("\t\tXY : NORTHWEST (%ld)", subvariant->rosetteScans[ROSETTE_NORTHWEST]);
|
||||
scanA = subvariant->rosetteScans[ROSETTE_NORTHWEST];
|
||||
shifA = subvariant->rosetteShift[ROSETTE_NORTHWEST];
|
||||
} else {
|
||||
TOUCH_JOY_LOG("\t\tXY : NORTHEAST (%ld)", subvariant->rosetteScans[ROSETTE_NORTHEAST]);
|
||||
scanA = subvariant->rosetteScans[ROSETTE_NORTHEAST];
|
||||
shifA = subvariant->rosetteShift[ROSETTE_NORTHEAST];
|
||||
}
|
||||
break;
|
||||
|
||||
@ -319,10 +345,13 @@ static void _subvariant_touchMove(subvariant_s *subvariant, int dx, int dy, bool
|
||||
if (subvariant->rosetteScans[ROSETTE_NORTHEAST] >= 0) {
|
||||
TOUCH_JOY_LOG("\t\tXY : NORTHEAST (%ld)", subvariant->rosetteScans[ROSETTE_NORTHEAST]);
|
||||
scanA = subvariant->rosetteScans[ROSETTE_NORTHEAST];
|
||||
shifA = subvariant->rosetteShift[ROSETTE_NORTHEAST];
|
||||
} else {
|
||||
TOUCH_JOY_LOG("\t\tXY : EAST (%ld) & NORTH (%ld)", subvariant->rosetteScans[ROSETTE_EAST], subvariant->rosetteScans[ROSETTE_NORTH]);
|
||||
scanA = subvariant->rosetteScans[ROSETTE_EAST];
|
||||
shifA = subvariant->rosetteShift[ROSETTE_EAST];
|
||||
scanB = subvariant->rosetteScans[ROSETTE_NORTH];
|
||||
shifB = subvariant->rosetteShift[ROSETTE_NORTH];
|
||||
}
|
||||
break;
|
||||
|
||||
@ -330,12 +359,15 @@ static void _subvariant_touchMove(subvariant_s *subvariant, int dx, int dy, bool
|
||||
if (subvariant->rosetteScans[ROSETTE_WEST] >= 0) {
|
||||
TOUCH_JOY_LOG("\t\tY : WEST (%ld)", subvariant->rosetteScans[ROSETTE_WEST]);
|
||||
scanA = subvariant->rosetteScans[ROSETTE_WEST];
|
||||
shifA = subvariant->rosetteShift[ROSETTE_WEST];
|
||||
} else if (radians > RADIANS_WEST_NEG && radians < 0) {
|
||||
TOUCH_JOY_LOG("\t\tXY : NORTHWEST (%ld)", subvariant->rosetteScans[ROSETTE_NORTHWEST]);
|
||||
scanA = subvariant->rosetteScans[ROSETTE_NORTHWEST];
|
||||
shifA = subvariant->rosetteShift[ROSETTE_NORTHWEST];
|
||||
} else {
|
||||
TOUCH_JOY_LOG("\t\tXY : SOUTHWEST (%ld)", subvariant->rosetteScans[ROSETTE_SOUTHWEST]);
|
||||
scanA = subvariant->rosetteScans[ROSETTE_SOUTHWEST];
|
||||
shifA = subvariant->rosetteShift[ROSETTE_SOUTHWEST];
|
||||
}
|
||||
break;
|
||||
|
||||
@ -343,12 +375,15 @@ static void _subvariant_touchMove(subvariant_s *subvariant, int dx, int dy, bool
|
||||
if (subvariant->rosetteScans[ROSETTE_EAST] >= 0) {
|
||||
TOUCH_JOY_LOG("\t\tY : EAST (%ld)", subvariant->rosetteScans[ROSETTE_EAST]);
|
||||
scanA = subvariant->rosetteScans[ROSETTE_EAST];
|
||||
shifA = subvariant->rosetteShift[ROSETTE_EAST];
|
||||
} else if (radians < RADIANS_EAST) {
|
||||
TOUCH_JOY_LOG("\t\tXY : NORTHEAST (%ld)", subvariant->rosetteScans[ROSETTE_NORTHEAST]);
|
||||
scanA = subvariant->rosetteScans[ROSETTE_NORTHEAST];
|
||||
shifA = subvariant->rosetteShift[ROSETTE_NORTHEAST];
|
||||
} else {
|
||||
TOUCH_JOY_LOG("\t\tXY : SOUTHEAST (%ld)", subvariant->rosetteScans[ROSETTE_SOUTHEAST]);
|
||||
scanA = subvariant->rosetteScans[ROSETTE_SOUTHEAST];
|
||||
shifA = subvariant->rosetteShift[ROSETTE_SOUTHEAST];
|
||||
}
|
||||
break;
|
||||
|
||||
@ -356,10 +391,13 @@ static void _subvariant_touchMove(subvariant_s *subvariant, int dx, int dy, bool
|
||||
if (subvariant->rosetteScans[ROSETTE_SOUTHWEST] >= 0) {
|
||||
TOUCH_JOY_LOG("\t\tXY : SOUTHWEST (%ld)", subvariant->rosetteScans[ROSETTE_SOUTHWEST]);
|
||||
scanA = subvariant->rosetteScans[ROSETTE_SOUTHWEST];
|
||||
shifA = subvariant->rosetteShift[ROSETTE_SOUTHWEST];
|
||||
} else {
|
||||
TOUCH_JOY_LOG("\t\tXY : WEST (%ld) & SOUTH (%ld)", subvariant->rosetteScans[ROSETTE_WEST], subvariant->rosetteScans[ROSETTE_SOUTH]);
|
||||
scanA = subvariant->rosetteScans[ROSETTE_WEST];
|
||||
shifA = subvariant->rosetteShift[ROSETTE_WEST];
|
||||
scanB = subvariant->rosetteScans[ROSETTE_SOUTH];
|
||||
shifB = subvariant->rosetteShift[ROSETTE_SOUTH];
|
||||
}
|
||||
break;
|
||||
|
||||
@ -367,12 +405,15 @@ static void _subvariant_touchMove(subvariant_s *subvariant, int dx, int dy, bool
|
||||
if (subvariant->rosetteScans[ROSETTE_SOUTH] >= 0) {
|
||||
TOUCH_JOY_LOG("\t\tY : SOUTH (%ld)", subvariant->rosetteScans[ROSETTE_SOUTH]);
|
||||
scanA = subvariant->rosetteScans[ROSETTE_SOUTH];
|
||||
shifA = subvariant->rosetteShift[ROSETTE_SOUTH];
|
||||
} else if (radians > RADIANS_SOUTH) {
|
||||
TOUCH_JOY_LOG("\t\tXY : SOUTHWEST (%ld)", subvariant->rosetteScans[ROSETTE_SOUTHWEST]);
|
||||
scanA = subvariant->rosetteScans[ROSETTE_SOUTHWEST];
|
||||
shifA = subvariant->rosetteShift[ROSETTE_SOUTHWEST];
|
||||
} else {
|
||||
TOUCH_JOY_LOG("\t\tXY : SOUTHEAST (%ld)", subvariant->rosetteScans[ROSETTE_SOUTHEAST]);
|
||||
scanA = subvariant->rosetteScans[ROSETTE_SOUTHEAST];
|
||||
shifA = subvariant->rosetteShift[ROSETTE_SOUTHEAST];
|
||||
}
|
||||
break;
|
||||
|
||||
@ -380,10 +421,13 @@ static void _subvariant_touchMove(subvariant_s *subvariant, int dx, int dy, bool
|
||||
if (subvariant->rosetteScans[ROSETTE_SOUTHEAST] >= 0) {
|
||||
TOUCH_JOY_LOG("\t\tXY : SOUTHEAST (%ld)", subvariant->rosetteScans[ROSETTE_SOUTHEAST]);
|
||||
scanA = subvariant->rosetteScans[ROSETTE_SOUTHEAST];
|
||||
shifA = subvariant->rosetteShift[ROSETTE_SOUTHEAST];
|
||||
} else {
|
||||
TOUCH_JOY_LOG("\t\tXY : EAST (%ld) & SOUTH (%ld)", subvariant->rosetteScans[ROSETTE_EAST], subvariant->rosetteScans[ROSETTE_SOUTH]);
|
||||
scanA = subvariant->rosetteScans[ROSETTE_EAST];
|
||||
shifA = subvariant->rosetteShift[ROSETTE_EAST];
|
||||
scanB = subvariant->rosetteScans[ROSETTE_SOUTH];
|
||||
shifB = subvariant->rosetteShift[ROSETTE_SOUTH];
|
||||
}
|
||||
break;
|
||||
|
||||
@ -398,6 +442,8 @@ static void _subvariant_touchMove(subvariant_s *subvariant, int dx, int dy, bool
|
||||
}
|
||||
subvariant->scancodes[REPEAT_IDX_A] = scanA;
|
||||
subvariant->scancodes[REPEAT_IDX_B] = scanB;
|
||||
subvariant->isShifted[REPEAT_IDX_A] = shifA;
|
||||
subvariant->isShifted[REPEAT_IDX_B] = shifB;
|
||||
} while (0);
|
||||
|
||||
if (subvariant->currentOctant != lastOctant) {
|
||||
@ -518,14 +564,15 @@ static void touchkpad_buttonUp(int dx, int dy) {
|
||||
// ----------------------------------------------------------------------------
|
||||
// prefs handling
|
||||
|
||||
static void _subvariant_prefsChanged(subvariant_s *subvariant, const char *domain, const char *prefCharsKey, const char *prefScansKey) {
|
||||
static void _subvariant_prefsChanged(subvariant_s *subvariant, const char *domain, const char *prefKey) {
|
||||
long lVal = 0;
|
||||
bool bVal = false;
|
||||
|
||||
// ASCII : "kp{Axis,Butt}RosetteChars" : [ 121, 127, 130, 100, 101, 121, 132, 120, 99 ]
|
||||
// ASCII : "kp{Axis,Butt}Rosette" : [ { "scan" : 16, "isShifted" : false, "ch" : 81 }, ... ]
|
||||
JSON_ref array = NULL;
|
||||
do {
|
||||
if (!prefs_copyJSONValue(domain, prefCharsKey, &array)) {
|
||||
LOG("could not parse touch keypad rosette");
|
||||
if (!prefs_copyJSONValue(domain, prefKey, &array)) {
|
||||
LOG("could not parse touch keypad rosette for domain %s", domain);
|
||||
break;
|
||||
}
|
||||
long count = 0;
|
||||
@ -538,29 +585,28 @@ static void _subvariant_prefsChanged(subvariant_s *subvariant, const char *domai
|
||||
break;
|
||||
}
|
||||
for (unsigned long i=0; i<ROSETTE_COUNT; i++) {
|
||||
subvariant->rosetteChars[i] = json_arrayParseLongValueAtIndex(array, i, &lVal, /*base:*/10) ? (uint8_t)lVal : ' ';
|
||||
}
|
||||
} while (0);
|
||||
JSON_ref map = NULL;
|
||||
|
||||
json_destroy(&array);
|
||||
if (json_arrayCopyJSONAtIndex(array, i, &map) <= 0) {
|
||||
LOG("could not parse touch keypad rosette data at index %lu!", i);
|
||||
break;
|
||||
}
|
||||
|
||||
// long : "kp{Axis,Butt}RosetteScans" : [ -1, 100, -1, 99, -1, 96, -1, 101, -1 ]
|
||||
do {
|
||||
if (!prefs_copyJSONValue(domain, prefScansKey, &array)) {
|
||||
LOG("could not parse touch keypad rosette");
|
||||
break;
|
||||
}
|
||||
long count = 0;
|
||||
if (!json_arrayCount(array, &count)) {
|
||||
LOG("rosette is not an array!");
|
||||
break;
|
||||
}
|
||||
if (count != ROSETTE_COUNT) {
|
||||
LOG("rosette count unexpected : %lu!", count);
|
||||
break;
|
||||
}
|
||||
for (unsigned long i=0; i<ROSETTE_COUNT; i++) {
|
||||
subvariant->rosetteScans[i] = json_arrayParseLongValueAtIndex(array, i, &lVal, /*base:*/10) ? lVal : -1;
|
||||
assert(map != NULL);
|
||||
if (!json_isMap(map)) {
|
||||
LOG("touch keypad rosette at index %lu is not a map!", i);
|
||||
break;
|
||||
}
|
||||
|
||||
subvariant->rosetteShift[i] = json_mapParseBoolValue(map, "isShifted", &bVal) ? bVal : false;
|
||||
|
||||
subvariant->rosetteChars[i] = json_mapParseLongValue(map, "ch", &lVal, /*base:*/10) ? (uint8_t)lVal : ' ';
|
||||
subvariant->rosetteScans[i] = json_mapParseLongValue(map, "scan", &lVal, /*base:*/10) ? lVal : -1;
|
||||
if (subvariant->rosetteScans[i] > 0x7f) {
|
||||
subvariant->rosetteScans[i] = -1;
|
||||
}
|
||||
|
||||
json_destroy(&map);
|
||||
}
|
||||
} while (0);
|
||||
|
||||
@ -576,7 +622,8 @@ static void touchkpad_prefsChanged(const char *domain) {
|
||||
kpad.autostrobeDelay = !(prefs_parseBoolValue(domain, PREF_KPAD_FAST_AUTOREPEAT, &bVal) ? bVal : true);
|
||||
|
||||
do {
|
||||
const int rosetteChars[ROSETTE_ROWS*ROSETTE_COLS] = {
|
||||
const bool rosetteShift[ROSETTE_ROWS*ROSETTE_COLS] = { false };
|
||||
const uint8_t rosetteChars[ROSETTE_ROWS*ROSETTE_COLS] = {
|
||||
ICONTEXT_NONACTIONABLE, 'I', ICONTEXT_NONACTIONABLE,
|
||||
'J', ICONTEXT_NONACTIONABLE, 'K',
|
||||
ICONTEXT_NONACTIONABLE, 'M', ICONTEXT_NONACTIONABLE,
|
||||
@ -587,30 +634,33 @@ static void touchkpad_prefsChanged(const char *domain) {
|
||||
-1, keys_ascii2Scancode('M'), -1,
|
||||
};
|
||||
for (unsigned long i=0; i<ROSETTE_COUNT; i++) {
|
||||
kpad.axis.rosetteShift[i] = rosetteShift[i];
|
||||
kpad.axis.rosetteChars[i] = rosetteChars[i];
|
||||
kpad.axis.rosetteScans[i] = rosetteScans[i];
|
||||
}
|
||||
|
||||
_subvariant_prefsChanged(&kpad.axis, domain, PREF_KPAD_AXIS_ROSETTE_CHAR_ARRAY, PREF_KPAD_AXIS_ROSETTE_SCAN_ARRAY);
|
||||
_subvariant_prefsChanged(&kpad.axis, domain, PREF_KPAD_AXIS_ROSETTE);
|
||||
} while (0);
|
||||
|
||||
do {
|
||||
const int rosetteChars[ROSETTE_ROWS*ROSETTE_COLS] = {
|
||||
const bool rosetteShift[ROSETTE_ROWS*ROSETTE_COLS] = { false };
|
||||
const uint8_t rosetteChars[ROSETTE_ROWS*ROSETTE_COLS] = {
|
||||
ICONTEXT_NONACTIONABLE, ICONTEXT_NONACTIONABLE, ICONTEXT_NONACTIONABLE,
|
||||
ICONTEXT_NONACTIONABLE, ICONTEXT_SPACE_VISUAL , ICONTEXT_NONACTIONABLE,
|
||||
ICONTEXT_NONACTIONABLE, ICONTEXT_NONACTIONABLE, ICONTEXT_NONACTIONABLE,
|
||||
};
|
||||
const int rosetteScans[ROSETTE_ROWS*ROSETTE_COLS] = {
|
||||
-1, -1 , -1,
|
||||
-1, keys_ascii2Scancode(' '), -1,
|
||||
-1, -1 , -1,
|
||||
keys_ascii2Scancode(' '), keys_ascii2Scancode(' '), keys_ascii2Scancode(' '),
|
||||
keys_ascii2Scancode(' '), keys_ascii2Scancode(' '), keys_ascii2Scancode(' '),
|
||||
keys_ascii2Scancode(' '), keys_ascii2Scancode(' '), keys_ascii2Scancode(' '),
|
||||
};
|
||||
for (unsigned long i=0; i<ROSETTE_COUNT; i++) {
|
||||
kpad.butt.rosetteShift[i] = rosetteShift[i];
|
||||
kpad.butt.rosetteChars[i] = rosetteChars[i];
|
||||
kpad.butt.rosetteScans[i] = rosetteScans[i];
|
||||
}
|
||||
|
||||
_subvariant_prefsChanged(&kpad.butt, domain, PREF_KPAD_BUTT_ROSETTE_CHAR_ARRAY, PREF_KPAD_BUTT_ROSETTE_SCAN_ARRAY);
|
||||
_subvariant_prefsChanged(&kpad.butt, domain, PREF_KPAD_BUTT_ROSETTE);
|
||||
} while (0);
|
||||
}
|
||||
|
||||
@ -657,7 +707,9 @@ static void _init_gltouchjoy_kpad(void) {
|
||||
|
||||
for (unsigned int i=0; i<MAX_REPEATING; i++) {
|
||||
kpad.axis.scancodes[i] = -1;
|
||||
kpad.axis.isShifted[i] = false;
|
||||
kpad.butt.scancodes[i] = -1;
|
||||
kpad.butt.isShifted[i] = false;
|
||||
}
|
||||
|
||||
kpadVariant.variant = &touchkpad_variant;
|
||||
|
Loading…
x
Reference in New Issue
Block a user