Make NativeSettings a serializable data class

This commit is contained in:
lynxnb 2023-02-22 19:51:25 +01:00 committed by Niccolò Betto
parent ee98aaaed1
commit 854ea1a42d

View File

@ -8,41 +8,66 @@ package emu.skyline.settings
import android.content.Context import android.content.Context
import emu.skyline.BuildConfig import emu.skyline.BuildConfig
import emu.skyline.utils.GpuDriverHelper import emu.skyline.utils.GpuDriverHelper
import kotlinx.serialization.Serializable
/** /**
* The settings that will be passed to libskyline when running and executable * The settings that will be passed to libskyline when running and executable
*/ */
class NativeSettings(context : Context, pref : PreferenceSettings) { @Serializable
@Suppress("unused")
data class NativeSettings(
// System // System
var isDocked : Boolean = pref.isDocked var isDocked : Boolean,
var usernameValue : String = pref.usernameValue var usernameValue : String,
var profilePictureValue : String = pref.profilePictureValue var profilePictureValue : String,
var systemLanguage : Int = pref.systemLanguage var systemLanguage : Int,
var systemRegion : Int = pref.systemRegion var systemRegion : Int,
// Display // Display
var forceTripleBuffering : Boolean = pref.forceTripleBuffering var forceTripleBuffering : Boolean,
var disableFrameThrottling : Boolean = pref.disableFrameThrottling var disableFrameThrottling : Boolean,
var disableShaderCache : Boolean = pref.disableShaderCache var disableShaderCache : Boolean,
// GPU // GPU
var gpuDriver : String = if (pref.gpuDriver == PreferenceSettings.SYSTEM_GPU_DRIVER) "" else pref.gpuDriver var gpuDriver : String,
var gpuDriverLibraryName : String = if (pref.gpuDriver == PreferenceSettings.SYSTEM_GPU_DRIVER) "" else GpuDriverHelper.getLibraryName(context, pref.gpuDriver) var gpuDriverLibraryName : String,
var executorSlotCountScale : Int = pref.executorSlotCountScale var executorSlotCountScale : Int,
var executorFlushThreshold : Int = pref.executorFlushThreshold var executorFlushThreshold : Int,
var useDirectMemoryImport : Boolean = pref.useDirectMemoryImport var useDirectMemoryImport : Boolean,
var forceMaxGpuClocks : Boolean = pref.forceMaxGpuClocks var forceMaxGpuClocks : Boolean,
// Hacks // Hacks
var enableFastGpuReadbackHack : Boolean = pref.enableFastGpuReadbackHack var enableFastGpuReadbackHack : Boolean,
var enableFastReadbackWrites : Boolean = pref.enableFastReadbackWrites var enableFastReadbackWrites : Boolean,
var disableSubgroupShuffle : Boolean = pref.disableSubgroupShuffle var disableSubgroupShuffle : Boolean,
// Audio // Audio
var isAudioOutputDisabled : Boolean = pref.isAudioOutputDisabled var isAudioOutputDisabled : Boolean,
// Debug // Debug
var validationLayer : Boolean = BuildConfig.BUILD_TYPE != "release" && pref.validationLayer var validationLayer : Boolean
) {
constructor(context : Context, pref : PreferenceSettings) : this(
pref.isDocked,
pref.usernameValue,
pref.profilePictureValue,
pref.systemLanguage,
pref.systemRegion,
pref.forceTripleBuffering,
pref.disableFrameThrottling,
pref.disableShaderCache,
if (pref.gpuDriver == EmulationSettings.SYSTEM_GPU_DRIVER) "" else pref.gpuDriver,
if (pref.gpuDriver == EmulationSettings.SYSTEM_GPU_DRIVER) "" else GpuDriverHelper.getLibraryName(context, pref.gpuDriver),
pref.executorSlotCountScale,
pref.executorFlushThreshold,
pref.useDirectMemoryImport,
pref.forceMaxGpuClocks,
pref.enableFastGpuReadbackHack,
pref.enableFastReadbackWrites,
pref.disableSubgroupShuffle,
pref.isAudioOutputDisabled,
BuildConfig.BUILD_TYPE != "release" && pref.validationLayer
)
/** /**
* Updates settings in libskyline during emulation * Updates settings in libskyline during emulation