Android: Controller binding support
This commit is contained in:
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M20,6h-8l-2,-2L4,4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,8c0,-1.1 -0.9,-2 -2,-2zM20,18L4,18L4,8h16v10z"/>
|
||||
</vector>
|
||||
10
android/app/src/main/res/drawable/ic_baseline_gamepad_24.xml
Normal file
10
android/app/src/main/res/drawable/ic_baseline_gamepad_24.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M15,7.5V2H9v5.5l3,3 3,-3zM7.5,9H2v6h5.5l3,-3 -3,-3zM9,16.5V22h6v-5.5l-3,-3 -3,3zM16.5,9l-3,3 3,3H22V9h-5.5z"/>
|
||||
</vector>
|
||||
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,7c-2.76,0 -5,2.24 -5,5s2.24,5 5,5 5,-2.24 5,-5 -2.24,-5 -5,-5zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
|
||||
</vector>
|
||||
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
|
||||
</vector>
|
||||
10
android/app/src/main/res/drawable/ic_baseline_save_24.xml
Normal file
10
android/app/src/main/res/drawable/ic_baseline_save_24.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M17,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,7l-4,-4zM12,19c-1.66,0 -3,-1.34 -3,-3s1.34,-3 3,-3 3,1.34 3,3 -1.34,3 -3,3zM15,9L5,9L5,5h10v4z"/>
|
||||
</vector>
|
||||
@ -0,0 +1,9 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/settings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tab_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:tabTextAppearance="@style/TabTextAppearance"
|
||||
app:tabMode="fixed" />
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/view_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/linearLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/controller_binding_icon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_alignParentTop="true"
|
||||
tools:srcCompat="@drawable/ic_media_cdrom" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/controller_binding_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:text="Up"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_toRightOf="@id/controller_binding_icon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/controller_binding_value"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="Controller0/Button0"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:layout_toRightOf="@id/controller_binding_icon"
|
||||
android:layout_below="@id/controller_binding_name" />
|
||||
|
||||
</RelativeLayout>
|
||||
20
android/app/src/main/res/menu/menu_controller_mapping.xml
Normal file
20
android/app/src/main/res/menu/menu_controller_mapping.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_load_profile"
|
||||
android:title="Load Profile"
|
||||
android:icon="@drawable/ic_baseline_folder_open_24"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_save_profile"
|
||||
android:title="Save Profile"
|
||||
android:icon="@drawable/ic_baseline_save_24"
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_clear_bindings"
|
||||
android:title="Clear Bindings"/>
|
||||
</menu>
|
||||
@ -36,6 +36,11 @@
|
||||
android:id="@+id/action_discord_server"
|
||||
android:title="@string/menu_main_discord_server" />
|
||||
</group>
|
||||
<item
|
||||
android:id="@+id/action_controller_mapping"
|
||||
android:icon="@drawable/ic_baseline_gamepad_24"
|
||||
android:orderInCategory="100"
|
||||
android:title="@string/action_controller_mapping" />
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:icon="@drawable/ic_baseline_settings_24"
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<resources>
|
||||
<string name="app_name">DuckStation</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="action_controller_mapping">Controller Mapping</string>
|
||||
<string name="title_activity_settings">Settings</string>
|
||||
<string name="settings_console_region">Console Region</string>
|
||||
<string name="settings_console_tty_output">Enable TTY Output</string>
|
||||
@ -160,4 +161,20 @@
|
||||
<string name="touchscreen_controller_reset_layout">Reset Layout</string>
|
||||
<string name="emulation_activity_touchscreen_controller_not_active">Touchscreen controller is not active.</string>
|
||||
<string name="settings_theme">Theme</string>
|
||||
<string name="settings_controller_mapping_summary">Allows you bind external controller buttons/axises to the emulated controller.</string>
|
||||
<string name="settings_controller_mapping">Controller Mapping</string>
|
||||
<string name="controller_binding_dialog_message">Press button on controller to set new binding.\n\nCurrent Binding: %s</string>
|
||||
<string name="controller_binding_dialog_no_binding"><![CDATA[<No Binding>]]></string>
|
||||
<string name="controller_binding_dialog_cancel">Cancel</string>
|
||||
<string name="controller_binding_dialog_clear">Clear</string>
|
||||
<string name="controller_mapping_activity_title">Controller Mapping</string>
|
||||
<string name="controller_mapping_activity_no_profiles_found">No profiles found.</string>
|
||||
<string name="controller_mapping_activity_select_input_profile">Select Input Profile</string>
|
||||
<string name="controller_mapping_activity_failed_to_load_profile">Failed to load profile \'%s\'</string>
|
||||
<string name="controller_mapping_activity_input_profile_name">Input Profile Name:</string>
|
||||
<string name="controller_mapping_activity_save">Save</string>
|
||||
<string name="controller_mapping_activity_name_must_be_provided">A name must be provided.</string>
|
||||
<string name="controller_mapping_activity_failed_to_save_input_profile">Failed to save input profile.</string>
|
||||
<string name="controller_mapping_activity_input_profile_saved">Input profile \'%s\' saved.</string>
|
||||
<string name="controller_mapping_activity_cancel">Cancel</string>
|
||||
</resources>
|
||||
|
||||
@ -14,7 +14,8 @@
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<ListPreference
|
||||
app:key="Controller1/Type"
|
||||
@ -24,6 +25,14 @@
|
||||
app:defaultValue="DigitalController"
|
||||
app:useSimpleSummaryProvider="true"
|
||||
app:iconSpaceReserved="false" />
|
||||
<Preference
|
||||
app:title="@string/settings_controller_mapping"
|
||||
app:summary="@string/settings_controller_mapping_summary"
|
||||
app:iconSpaceReserved="false">
|
||||
<intent android:action="android.intent.action.VIEW"
|
||||
android:targetClass="com.github.stenzek.duckstation.ControllerMappingActivity"
|
||||
android:targetPackage="com.github.stenzek.duckstation" />
|
||||
</Preference>
|
||||
<SwitchPreferenceCompat
|
||||
app:key="Controller1/ForceAnalogOnReset"
|
||||
app:title="@string/settings_enable_analog_mode_on_reset"
|
||||
|
||||
Reference in New Issue
Block a user