diff --git a/android/native/jni/input_android.c b/android/native/jni/input_android.c index dcf5766d82..5bc4e6f488 100644 --- a/android/native/jni/input_android.c +++ b/android/native/jni/input_android.c @@ -47,6 +47,8 @@ static void *android_input_init(void) { pads_connected = 0; + input_autodetect_init(); + for(unsigned player = 0; player < 4; player++) for(unsigned i = 0; i < RARCH_FIRST_META_KEY; i++) { @@ -73,8 +75,6 @@ static void *android_input_init(void) g_settings.input.binds[player][RETRO_DEVICE_ID_JOYPAD_L3].joykey = (1ULL << RETRO_DEVICE_ID_JOYPAD_L3); g_settings.input.binds[player][RETRO_DEVICE_ID_JOYPAD_R3].joykey = (1ULL << RETRO_DEVICE_ID_JOYPAD_R3); } - - input_autodetect_init(); return (void*)-1; } diff --git a/android/native/jni/input_autodetect.c b/android/native/jni/input_autodetect.c index 859dfec642..a714248dc8 100644 --- a/android/native/jni/input_autodetect.c +++ b/android/native/jni/input_autodetect.c @@ -73,10 +73,27 @@ end: void input_autodetect_init (void) { - for(int j = 0; j < LAST_KEYCODE; j++) + int j, k; + for(j = 0; j < LAST_KEYCODE; j++) keycode_lut[j] = 0; volume_enable = true; + + if (g_settings.input.autodetect_enable) + return; + + for (j = 0; j < MAX_PADS; j++) + { + uint8_t shift = 8 + (j * 8); + for (k = 0; k < RARCH_FIRST_CUSTOM_BIND; k++) + { + if (g_settings.input.binds[j][k].valid && g_settings.input.binds[j][k].joykey && g_settings.input.binds[j][k].joykey < LAST_KEYCODE) + { + RARCH_LOG("binding %llu to %d (p%d)\n", g_settings.input.binds[j][k].joykey, k, j); + keycode_lut[g_settings.input.binds[j][k].joykey] |= ((k + 1) << shift); + } + } + } } void input_autodetect_setup (void *data, char *msg, size_t sizeof_msg, unsigned port, unsigned id, int source) diff --git a/android/phoenix/res/xml/prefs.xml b/android/phoenix/res/xml/prefs.xml index 9ea35c624f..62f280377d 100644 --- a/android/phoenix/res/xml/prefs.xml +++ b/android/phoenix/res/xml/prefs.xml @@ -165,7 +165,8 @@ android:defaultValue="true" android:key="input_autodetect_enable" android:summary="This will attempt to preconfigure various gamepads and/or IME apps that you connect." - android:title="Enable" /> + android:title="Enable" + android:disableDependentsState="true" /> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/android/phoenix/src/org/retroarch/browser/RetroArch.java b/android/phoenix/src/org/retroarch/browser/RetroArch.java index b8ea8dd224..a9ead15aea 100644 --- a/android/phoenix/src/org/retroarch/browser/RetroArch.java +++ b/android/phoenix/src/org/retroarch/browser/RetroArch.java @@ -342,6 +342,16 @@ public class RetroArch extends Activity implements prefs.getString("savestate_directory", "") : ""); config.setBoolean("video_font_enable", prefs.getBoolean("video_font_enable", true)); + + for (int i = 1; i <= 4; i++) + { + final String btns[] = {"up", "down", "left", "right", "a", "b", "x", "y", "start", "select", "l", "r", "l2", "r2", "l3", "r3" }; + for (String b : btns) + { + String p = "input_player" + String.valueOf(i) + "_" + b + "_btn"; + config.setInt(p, prefs.getInt(p, 0)); + } + } String confPath = getDefaultConfigPath(); try {