(Android) Add back button behavior option
This commit is contained in:
parent
e07c4872db
commit
6899434609
|
@ -367,6 +367,12 @@ static void android_input_poll(void *data)
|
||||||
&& input_state > 0)
|
&& input_state > 0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
else if (g_settings.input.back_behavior == BACK_BUTTON_MENU_TOGGLE)
|
||||||
|
{
|
||||||
|
*lifecycle_state |= (1ULL << RARCH_RMENU_TOGGLE);
|
||||||
|
AInputQueue_finishEvent(android_app->inputQueue, event, handled);
|
||||||
|
break;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*lifecycle_state |= (1ULL << RARCH_QUIT_KEY);
|
*lifecycle_state |= (1ULL << RARCH_QUIT_KEY);
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
<string-array name="back_options">
|
||||||
|
<item>Quit</item>
|
||||||
|
<item>Menu toggle</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="back_options_values">
|
||||||
|
<item>0</item>
|
||||||
|
<item>1</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
<string-array name="aspect_ratios">
|
<string-array name="aspect_ratios">
|
||||||
<item>Full screen</item>
|
<item>Full screen</item>
|
||||||
<item>Auto</item>
|
<item>Auto</item>
|
||||||
|
|
|
@ -187,6 +187,14 @@
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
<PreferenceScreen android:title="Input Settings" >
|
<PreferenceScreen android:title="Input Settings" >
|
||||||
|
<PreferenceCategory android:title="General" >
|
||||||
|
<ListPreference
|
||||||
|
android:entries="@array/back_options"
|
||||||
|
android:entryValues="@array/back_options_values"
|
||||||
|
android:key="input_back_behavior"
|
||||||
|
android:summary="Select how you want the Back button to behave."
|
||||||
|
android:title="Back behavior" />
|
||||||
|
</PreferenceCategory>
|
||||||
<PreferenceCategory android:title="Configuration Autodetect" >
|
<PreferenceCategory android:title="Configuration Autodetect" >
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
|
|
|
@ -363,6 +363,7 @@ public class RetroArch extends Activity implements
|
||||||
config.setBoolean("video_vsync", prefs.getBoolean("video_vsync", true));
|
config.setBoolean("video_vsync", prefs.getBoolean("video_vsync", true));
|
||||||
config.setBoolean("input_autodetect_enable", prefs.getBoolean("input_autodetect_enable", true));
|
config.setBoolean("input_autodetect_enable", prefs.getBoolean("input_autodetect_enable", true));
|
||||||
config.setBoolean("input_debug_enable", prefs.getBoolean("input_debug_enable", false));
|
config.setBoolean("input_debug_enable", prefs.getBoolean("input_debug_enable", false));
|
||||||
|
config.setInt("input_back_behavior", Integer.valueOf(prefs.getString("input_back_behavior", "0")));
|
||||||
config.setInt("input_autodetect_icade_profile_pad1", Integer.valueOf(prefs.getString("input_autodetect_icade_profile_pad1", "0")));
|
config.setInt("input_autodetect_icade_profile_pad1", Integer.valueOf(prefs.getString("input_autodetect_icade_profile_pad1", "0")));
|
||||||
config.setInt("input_autodetect_icade_profile_pad2", Integer.valueOf(prefs.getString("input_autodetect_icade_profile_pad2", "0")));
|
config.setInt("input_autodetect_icade_profile_pad2", Integer.valueOf(prefs.getString("input_autodetect_icade_profile_pad2", "0")));
|
||||||
config.setInt("input_autodetect_icade_profile_pad3", Integer.valueOf(prefs.getString("input_autodetect_icade_profile_pad3", "0")));
|
config.setInt("input_autodetect_icade_profile_pad3", Integer.valueOf(prefs.getString("input_autodetect_icade_profile_pad3", "0")));
|
||||||
|
|
|
@ -242,6 +242,7 @@ struct settings
|
||||||
bool debug_enable;
|
bool debug_enable;
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
bool autodetect_enable;
|
bool autodetect_enable;
|
||||||
|
unsigned back_behavior;
|
||||||
unsigned icade_profile[MAX_PLAYERS];
|
unsigned icade_profile[MAX_PLAYERS];
|
||||||
unsigned icade_count;
|
unsigned icade_count;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -49,6 +49,14 @@ static inline void input_conv_analog_id_to_bind_id(unsigned index, unsigned id,
|
||||||
bool input_translate_coord_viewport(int mouse_x, int mouse_y,
|
bool input_translate_coord_viewport(int mouse_x, int mouse_y,
|
||||||
int16_t *res_x, int16_t *res_y, int16_t *res_screen_x, int16_t *res_screen_y);
|
int16_t *res_x, int16_t *res_y, int16_t *res_screen_x, int16_t *res_screen_y);
|
||||||
|
|
||||||
|
#ifdef ANDROID
|
||||||
|
enum back_button_enums
|
||||||
|
{
|
||||||
|
BACK_BUTTON_QUIT = 0,
|
||||||
|
BACK_BUTTON_MENU_TOGGLE,
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct rarch_joypad_driver
|
typedef struct rarch_joypad_driver
|
||||||
{
|
{
|
||||||
bool (*init)(void);
|
bool (*init)(void);
|
||||||
|
|
|
@ -239,6 +239,7 @@ void config_set_defaults(void)
|
||||||
g_settings.input.debug_enable = input_debug_enable;
|
g_settings.input.debug_enable = input_debug_enable;
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
g_settings.input.autodetect_enable = input_autodetect_enable;
|
g_settings.input.autodetect_enable = input_autodetect_enable;
|
||||||
|
g_settings.input.back_behavior = BACK_BUTTON_QUIT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (int i = 0; i < MAX_PLAYERS; i++)
|
for (int i = 0; i < MAX_PLAYERS; i++)
|
||||||
|
@ -699,6 +700,7 @@ bool config_load_file(const char *path)
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
CONFIG_GET_BOOL(input.autodetect_enable, "input_autodetect_enable");
|
CONFIG_GET_BOOL(input.autodetect_enable, "input_autodetect_enable");
|
||||||
|
CONFIG_GET_INT(input.back_behavior, "input_back_behavior");
|
||||||
CONFIG_GET_INT(input.icade_profile[0], "input_autodetect_icade_profile_pad1");
|
CONFIG_GET_INT(input.icade_profile[0], "input_autodetect_icade_profile_pad1");
|
||||||
CONFIG_GET_INT(input.icade_profile[1], "input_autodetect_icade_profile_pad2");
|
CONFIG_GET_INT(input.icade_profile[1], "input_autodetect_icade_profile_pad2");
|
||||||
CONFIG_GET_INT(input.icade_profile[2], "input_autodetect_icade_profile_pad3");
|
CONFIG_GET_INT(input.icade_profile[2], "input_autodetect_icade_profile_pad3");
|
||||||
|
@ -1197,6 +1199,7 @@ bool config_save_file(const char *path)
|
||||||
config_set_string(conf, "audio_resampler", g_settings.audio.resampler);
|
config_set_string(conf, "audio_resampler", g_settings.audio.resampler);
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
|
config_set_int(conf, "input_back_behavior", input.back_behavior);
|
||||||
config_set_int(conf, "input_autodetect_icade_profile_pad1", input.icade_profile[0]);
|
config_set_int(conf, "input_autodetect_icade_profile_pad1", input.icade_profile[0]);
|
||||||
config_set_int(conf, "input_autodetect_icade_profile_pad2", input.icade_profile[1]);
|
config_set_int(conf, "input_autodetect_icade_profile_pad2", input.icade_profile[1]);
|
||||||
config_set_int(conf, "input_autodetect_icade_profile_pad3", input.icade_profile[2]);
|
config_set_int(conf, "input_autodetect_icade_profile_pad3", input.icade_profile[2]);
|
||||||
|
|
Loading…
Reference in New Issue