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

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

26 lines
833 B
Kotlin
Raw Normal View History

// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
2024-03-05 03:42:40 -05:00
// SPDX-License-Identifier: GPL-2.0-or-later
2024-03-31 20:08:49 -04:00
package dev.suyu.suyu_emu.features.settings.model
2024-03-05 03:42:40 -05:00
2024-03-31 20:08:49 -04:00
import dev.suyu.suyu_emu.utils.NativeConfig
2024-03-05 03:42:40 -05:00
enum class ByteSetting(override val key: String) : AbstractByteSetting {
AUDIO_VOLUME("volume");
override fun getByte(needsGlobal: Boolean): Byte = NativeConfig.getByte(key, needsGlobal)
override fun setByte(value: Byte) {
if (NativeConfig.isPerGameConfigLoaded()) {
global = false
}
NativeConfig.setByte(key, value)
}
override val defaultValue: Byte by lazy { NativeConfig.getDefaultToString(key).toByte() }
override fun getValueAsString(needsGlobal: Boolean): String = getByte(needsGlobal).toString()
override fun reset() = NativeConfig.setByte(key, defaultValue)
}