(Android) Add autodetect_enable entry to settings

This commit is contained in:
twinaphex 2013-01-05 04:58:30 +01:00
parent e76ce3d525
commit 4eeac9a1d7
8 changed files with 385 additions and 359 deletions

View File

@ -115,6 +115,7 @@ static void android_input_poll(void *data)
{
state_id = pads_connected;
state_device_ids[pads_connected++] = id;
input_autodetect_setup(state_id, id, source);
}

View File

@ -101,8 +101,9 @@ void input_autodetect_setup(unsigned port, unsigned id, int source)
char *current_ime = g_android.current_ime;
if (g_settings.input.autodetect_enable)
{
input_autodetect_get_device_name(name_buf, sizeof(name_buf), id);
if (*name_buf)
{
if (strstr(name_buf, "Logitech"))
@ -302,6 +303,14 @@ void input_autodetect_setup(unsigned port, unsigned id, int source)
keycode_lut[AKEYCODE_BUTTON_R1] |= ((RETRO_DEVICE_ID_JOYPAD_R+1) << shift);
}
}
else if (source == AINPUT_SOURCE_TOUCHSCREEN)
{
snprintf(msg, sizeof(msg), "RetroPad #%d is: Touchscreen.\n", port);
}
else if (source == AINPUT_SOURCE_MOUSE)
{
snprintf(msg, sizeof(msg), "RetroPad #%d is: Mouse.\n", port);
}
else if (source == AINPUT_SOURCE_KEYBOARD)
{
snprintf(msg, sizeof(msg), "RetroPad #%d is: Keyboard.\n", port);
@ -466,19 +475,15 @@ void input_autodetect_setup(unsigned port, unsigned id, int source)
keycode_lut[AKEYCODE_1] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
keycode_lut[AKEYCODE_HOME] |= ((RARCH_RESET+1) << shift);
}
}
if (name_buf[0] != 0)
RARCH_LOG("Device %d: %s, port: %d.\n", id, name_buf, port);
unsigned timeout_val = 30;
if (msg[0] == 0)
if (msg[0] == 0 && name_buf[0] != 0)
{
if (source == AINPUT_SOURCE_TOUCHSCREEN)
snprintf(msg, sizeof(msg), "RetroPad #%d is: Touchscreen.\n", port);
else if (source == AINPUT_SOURCE_MOUSE)
snprintf(msg, sizeof(msg), "RetroPad #%d is: Mouse.\n", port);
else if (name_buf[0] != 0)
snprintf(msg, sizeof(msg), "HID [%s] unbound.\n", name_buf);
timeout_val = 120;
}

View File

@ -3,10 +3,11 @@
<string name="app_name">RetroArch</string>
<string name="input_method">Input Method</string>
<string name="file_type_icon">File type icon</string>
<string name="video_settings">Video Config</string>
<string name="rarch_settings">RetroArch Config</string>
<string name="audio_settings">Audio Config</string>
<string name="general_settings">General Config</string>
<string name="video_settings">Video Settings</string>
<string name="rarch_settings">RetroArch Settings</string>
<string name="audio_settings">Audio Settings</string>
<string name="input_settings">Input Settings</string>
<string name="general_settings">General Settings</string>
<string name="settings">Settings</string>
</resources>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="RetroArch Config" >
android:title="RetroArch Settings" >
<PreferenceScreen android:title="System Config" >
<PreferenceScreen android:title="System Settings" >
<PreferenceCategory android:title="General" >
<CheckBoxPreference
android:defaultValue="false"
@ -18,7 +18,7 @@
android:title="Enable" />
</PreferenceCategory>
</PreferenceScreen>
<PreferenceScreen android:title="Video Config" >
<PreferenceScreen android:title="Video Settings" >
<PreferenceCategory android:title="General" >
<CheckBoxPreference
android:defaultValue="true"
@ -105,19 +105,27 @@
android:summary="Use bilinear filtering on FBO texture on second pass."
android:title="Second pass bilinear" />
</PreferenceScreen>
<PreferenceScreen android:title="Audio Config" >
<PreferenceCategory android:title="General" >
<PreferenceScreen android:title="Audio Settings" >
<PreferenceCategory android:title="Audio" >
<CheckBoxPreference
android:defaultValue="true"
android:key="audio_enable"
android:summary="Enable audio."
android:title="Audio enable" />
android:title="Enable" />
<CheckBoxPreference
android:defaultValue="true"
android:key="audio_rate_control"
android:summary="Enable dynamic rate control."
android:summary="Enable dynamic rate control (recommended)."
android:title="Dynamic Rate Control" />
</PreferenceCategory>
</PreferenceScreen>
<PreferenceScreen android:title="Input Settings" >
<PreferenceCategory android:title="Configuration" >
<CheckBoxPreference
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" />
</PreferenceCategory>
</PreferenceScreen>
</PreferenceScreen>

View File

@ -197,6 +197,7 @@ public class RetroArch extends Activity implements
config.setBoolean("savestate_auto_save", prefs.getBoolean("savestate_auto_save", false));
config.setBoolean("rewind_enable", prefs.getBoolean("rewind_enable", false));
config.setBoolean("video_vsync", prefs.getBoolean("video_vsync", true));
config.setBoolean("input_autodetect_enable", prefs.getBoolean("input_autodetect_enable", true));
String aspect = prefs.getString("video_aspect_ratio", "auto");
if (aspect.equals("full")) {

View File

@ -182,6 +182,9 @@ struct settings
float axis_threshold;
int joypad_map[MAX_PLAYERS];
unsigned dpad_emulation[MAX_PLAYERS];
#ifdef ANDROID
bool autodetect_enable;
#endif
#ifdef RARCH_CONSOLE
unsigned currently_selected_controller_no;
unsigned map_dpad_to_stick;

View File

@ -194,6 +194,10 @@
# Path to input overlay
# input_overlay =
# Enable input auto-detection (used on Android). Will attempt to autoconfigure
# gamepads, Plug-and-Play style.
# input_autodetect_enable = true
# Keyboard input. Will recognize normal keypresses and special keys like "left", "right", and so on.
# Keyboard input, Joypad and Joyaxis will all obey the "nul" bind, which disables the bind completely,
# rather than relying on a default.

View File

@ -493,6 +493,9 @@ bool config_load_file(const char *path)
CONFIG_GET_INT(input.turbo_duty_cycle, "input_duty_cycle");
CONFIG_GET_PATH(input.overlay, "input_overlay");
#ifdef ANDROID
CONFIG_GET_BOOL(input.autodetect_enable, "input_autodetect_enable");
#endif
if (config_get_string(conf, "environment_variables",
&g_extern.system.environment))