1
0
mirror of https://github.com/libretro/RetroArch synced 2025-04-01 04:20:27 +00:00

(Android) Add ICade profile option

This commit is contained in:
twinaphex 2013-02-09 11:44:32 +01:00
parent 6a6ad5d606
commit fa582bf15e
7 changed files with 95 additions and 30 deletions
android
native/jni
phoenix
res
src/org/retroarch/browser
general.hsettings.c

@ -601,6 +601,13 @@ void input_autodetect_setup (void *data, char *msg, size_t sizeof_msg, unsigned
}
else if (strstr(name_buf, "Broadcom Bluetooth HID"))
{
if ((g_settings.input.icade_count +1) < 4)
{
g_settings.input.icade_count++;
switch(g_settings.input.icade_profile[g_settings.input.icade_count])
{
case ICADE_PROFILE_RED_SAMURAI:
/* TODO: unsure about Select button here */
/* TODO: hookup right stick
* RStick Up: 37
@ -631,6 +638,9 @@ void input_autodetect_setup (void *data, char *msg, size_t sizeof_msg, unsigned
keycode_lut[AKEYCODE_2] |= ((RETRO_DEVICE_ID_JOYPAD_A+1) << shift);
keycode_lut[AKEYCODE_3] |= ((RETRO_DEVICE_ID_JOYPAD_Y+1) << shift);
keycode_lut[AKEYCODE_4] |= ((RETRO_DEVICE_ID_JOYPAD_X+1) << shift);
break;
}
}
}
else if (strstr(name_buf, "USB Gamepad") || strstr(name_buf, "DragonRise"))
{

@ -21,6 +21,10 @@
#define AKEY_EVENT_NO_ACTION 255
enum {
ICADE_PROFILE_RED_SAMURAI = 0,
} icade_profile_enums;
enum {
AKEYCODE_META_FUNCTION_ON = 8,
AKEYCODE_ESCAPE = 111,

@ -20,6 +20,14 @@
<item>1.14286</item>
</string-array>
<string-array name="icade_profiles">
<item>Red Samurai</item>
</string-array>
<string-array name="icade_profiles_values">
<item>0</item>
</string-array>
<string-array name="fbo_scales">
<item>1.0x</item>
<item>2.0x</item>

@ -168,6 +168,30 @@
android:summary="This will attempt to preconfigure various gamepads and/or IME apps that you connect."
android:title="Enable"
android:disableDependentsState="true" />
<ListPreference
android:entries="@array/icade_profiles"
android:entryValues="@array/icade_profiles_values"
android:key="input_autodetect_icade_profile_pad0"
android:summary="Select the iCade profile to use for controller 1."
android:title="iCade profile Pad 1" />
<ListPreference
android:entries="@array/icade_profiles"
android:entryValues="@array/icade_profiles_values"
android:key="input_autodetect_icade_profile_pad1"
android:summary="Select the iCade profile to use for controller 2."
android:title="iCade profile Pad 2" />
<ListPreference
android:entries="@array/icade_profiles"
android:entryValues="@array/icade_profiles_values"
android:key="input_autodetect_icade_profile_pad2"
android:summary="Select the iCade profile to use for controller 3."
android:title="iCade profile Pad 3" />
<ListPreference
android:entries="@array/icade_profiles"
android:entryValues="@array/icade_profiles_values"
android:key="input_autodetect_icade_profile_pad3"
android:summary="Select the iCade profile to use for controller 4."
android:title="iCade profile Pad 4" />
</PreferenceCategory>
<PreferenceCategory android:title="Debug input reporting" >
<CheckBoxPreference

@ -324,6 +324,10 @@ public class RetroArch extends Activity implements
config.setBoolean("video_vsync", prefs.getBoolean("video_vsync", true));
config.setBoolean("input_autodetect_enable", prefs.getBoolean("input_autodetect_enable", true));
config.setBoolean("input_debug_enable", prefs.getBoolean("input_debug_enable", false));
config.setInt("input_autodetect_icade_profile_pad1", prefs.getInt("input_autodetect_icade_profile_pad1", 0));
config.setInt("input_autodetect_icade_profile_pad2", prefs.getInt("input_autodetect_icade_profile_pad2", 0));
config.setInt("input_autodetect_icade_profile_pad3", prefs.getInt("input_autodetect_icade_profile_pad3", 0));
config.setInt("input_autodetect_icade_profile_pad4", prefs.getInt("input_autodetect_icade_profile_pad4", 0));
if (prefs.getBoolean("video_sync_refreshrate_to_screen", true)
&& (getRefreshRate() < 59.95)) {

@ -235,6 +235,8 @@ struct settings
bool debug_enable;
#ifdef ANDROID
bool autodetect_enable;
unsigned icade_profile[MAX_PLAYERS];
unsigned icade_count;
#endif
#ifdef RARCH_CONSOLE
uint64_t default_binds[RARCH_CUSTOM_BIND_LIST_END];

@ -468,7 +468,7 @@ bool config_load_file(const char *path)
CONFIG_GET_INT(video.aspect_ratio_idx, "aspect_ratio_index");
CONFIG_GET_FLOAT(video.aspect_ratio, "video_aspect_ratio");
for (unsigned i = 0; i < 8; i++)
for (unsigned i = 0; i < MAX_PLAYERS; i++)
{
char cfg[64];
snprintf(cfg, sizeof(cfg), "input_dpad_emulation_p%u", i + 1);
@ -477,6 +477,12 @@ bool config_load_file(const char *path)
CONFIG_GET_INT(input.device[i], cfg);
}
#ifdef ANDROID
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[2], "input_autodetect_icade_profile_pad3");
CONFIG_GET_INT(input.icade_profile[3], "input_autodetect_icade_profile_pad4");
#endif
CONFIG_GET_BOOL_EXTERN(console.screen.gamma_correction, "gamma_correction");
@ -1181,6 +1187,13 @@ bool config_save_file(const char *path)
config_set_string(conf, "system_directory", g_settings.system_directory);
config_set_string(conf, "audio_resampler", g_settings.audio.resampler);
#ifdef ANDROID
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_pad3", input.icade_profile[2]);
config_set_int(conf, "input_autodetect_icade_profile_pad4", input.icade_profile[3]);
#endif
if (g_extern.lifecycle_mode_state & (1ULL << MODE_VIDEO_OVERSCAN_ENABLE))
config_set_bool(conf, "overscan_enable", true);
else