Skip to content

Commit

Permalink
Update and rename Wireless Controller.cfg to Wireless Controller (dis…
Browse files Browse the repository at this point in the history
…abled).cfg

#!/bin/bash

input_device_display_name="Data Frog P02"
old_value__input_l2="104"
new_value__input_l2="+6"
old_value__input_r2="105"
new_value__input_r2="+7"
extend_filename=" (disabled)"

sed -i "
/input_device/a input_device_display_name = \"$input_device_display_name\"

/input_vendor_id/i\# Due to the uncommon nature of this device, the autoconfig file is not active by default. This precaution is taken to avoid potential conflicts with the widely-used Sony-PlayStation4-DualShock4-Controller.cfg file. To activate this configuration, you'll need to remove the comment symbols from the two lines that follow :

# Inactivate the controller
s/^input_vendor_id/# &/
s/^input_product_id/# &/
" "$1"

sed -i "
s|input_l2_btn = \"$old_value__input_l2\"|input_l2_axis = \"$new_value__input_l2\"|;
s|input_r2_btn = \"$old_value__input_r2\"|input_r2_axis = \"$new_value__input_r2\"|;
" "$1"

#####################################
# Add multicomment text block that is easy to copy/paste to this file

# Define the content to be inserted
read -r -d '' insert_content << EOF
# RetroArch's in-app feature to create autoconfig files is flawed (libretro/RetroArch#6920) and will attempt to create the 2 lines :
#   input_l2_btn = "$old_value__input_l2"
#   input_r2_btn = "$old_value__input_r2"
# Those 2 lines are a downgrade from the 2 following lines (copied from Sony_DualShock_4_Controller_v2.cfg) which additionally allow l2/r2 to be polled as analog axises :
EOF

# Create a unique temporary file
tmp_file="/tmp/tmp_file"

# Write insert content to the temporary file
echo "$insert_content" > "$tmp_file"

# Add lines above "world"
sed -i "/^input_l2_axis/e cat $tmp_file" "$1"

# Remove the temporary file
rm "$tmp_file"


###########################

mv "$1" "$(echo "$1" | sed "s|.cfg|$extend_filename.cfg|")"
  • Loading branch information
davidhedlund authored Jul 14, 2024
1 parent 27e20a8 commit 10ecedd
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 32 deletions.
35 changes: 35 additions & 0 deletions android/Wireless Controller (disabled).cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
input_driver = "android"
input_device = "Wireless Controller"
input_device_display_name = "Data Frog P02"
# Due to the uncommon nature of this device, the autoconfig file is not active by default. This precaution is taken to avoid potential conflicts with the widely-used Sony-PlayStation4-DualShock4-Controller.cfg file. To activate this configuration, you'll need to remove the comment symbols from the two lines that follow :
# input_vendor_id = "1356"
# input_product_id = "1476"
input_b_btn = "96"
input_y_btn = "99"
input_select_btn = "109"
input_start_btn = "108"
input_up_btn = "h0up"
input_down_btn = "h0down"
input_left_btn = "h0left"
input_right_btn = "h0right"
input_a_btn = "97"
input_x_btn = "100"
input_l_btn = "102"
input_r_btn = "103"
# RetroArch's in-app feature to create autoconfig files is flawed (https://github.com/libretro/RetroArch/issues/6920) and will attempt to create the 2 lines :
# input_l2_btn = "104"
# input_r2_btn = "105"
# Those 2 lines are a downgrade from the 2 following lines (copied from Sony_DualShock_4_Controller_v2.cfg) which additionally allow l2/r2 to be polled as analog axises :
input_l2_axis = "+6"
input_r2_axis = "+7"
input_l3_btn = "106"
input_r3_btn = "107"
input_l_x_plus_axis = "+0"
input_l_x_minus_axis = "-0"
input_l_y_plus_axis = "+1"
input_l_y_minus_axis = "-1"
input_r_x_plus_axis = "+2"
input_r_x_minus_axis = "-2"
input_r_y_plus_axis = "+3"
input_r_y_minus_axis = "-3"
input_menu_toggle_btn = "110"
32 changes: 0 additions & 32 deletions android/Wireless Controller.cfg

This file was deleted.

0 comments on commit 10ecedd

Please sign in to comment.