summaryrefslogtreecommitdiffstats
path: root/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/InputProfileSetting.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/InputProfileSetting.kt')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/InputProfileSetting.kt32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/InputProfileSetting.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/InputProfileSetting.kt
new file mode 100644
index 000000000..c46de08c5
--- /dev/null
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/features/settings/model/view/InputProfileSetting.kt
@@ -0,0 +1,32 @@
+// SPDX-FileCopyrightText: 2024 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+package org.yuzu.yuzu_emu.features.settings.model.view
+
+import org.yuzu.yuzu_emu.R
+import org.yuzu.yuzu_emu.features.input.NativeInput
+import org.yuzu.yuzu_emu.utils.NativeConfig
+
+class InputProfileSetting(private val playerIndex: Int) :
+ SettingsItem(emptySetting, R.string.profile, "", 0, "") {
+ override val type = TYPE_INPUT_PROFILE
+
+ fun getCurrentProfile(): String =
+ NativeConfig.getInputSettings(true)[playerIndex].profileName
+
+ fun getProfileNames(): Array<String> = NativeInput.getInputProfileNames()
+
+ fun isProfileNameValid(name: String): Boolean = NativeInput.isProfileNameValid(name)
+
+ fun createProfile(name: String): Boolean = NativeInput.createProfile(name, playerIndex)
+
+ fun deleteProfile(name: String): Boolean = NativeInput.deleteProfile(name, playerIndex)
+
+ fun loadProfile(name: String): Boolean {
+ val result = NativeInput.loadProfile(name, playerIndex)
+ NativeInput.reloadInputDevices()
+ return result
+ }
+
+ fun saveProfile(name: String): Boolean = NativeInput.saveProfile(name, playerIndex)
+}