suyu/src/android/app/src/main/java/dev/suyu/suyu_emu/features/settings/model/view/InputProfileSetting.kt

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
1.2 KiB
Kotlin
Raw Normal View History

// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
2024-03-12 03:30:43 +01:00
// SPDX-FileCopyrightText: 2024 suyu Emulator Project
2024-03-05 09:42:40 +01:00
// SPDX-License-Identifier: GPL-2.0-or-later
2024-04-01 02:08:49 +02:00
package dev.suyu.suyu_emu.features.settings.model.view
2024-03-05 09:42:40 +01:00
2024-04-01 02:08:49 +02:00
import dev.suyu.suyu_emu.R
import dev.suyu.suyu_emu.features.input.NativeInput
import dev.suyu.suyu_emu.utils.NativeConfig
2024-03-05 09:42:40 +01:00
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)
}