forked from MeloNX/MeloNX
add more options, fix vsync option
This commit is contained in:
parent
7b1ce437ef
commit
e9c7564a03
@ -91,7 +91,13 @@ class GameHost(context: Context?, val controller: GameController, val mainViewMo
|
|||||||
|
|
||||||
var surface = surfaceHolder.surface;
|
var surface = surfaceHolder.surface;
|
||||||
|
|
||||||
var success = _nativeRyujinx.graphicsInitialize(GraphicsConfiguration())
|
var settings = QuickSettings(mainViewModel.activity)
|
||||||
|
|
||||||
|
var success = _nativeRyujinx.graphicsInitialize(GraphicsConfiguration().apply {
|
||||||
|
EnableShaderCache = settings.enableShaderCache
|
||||||
|
EnableTextureRecompression = settings.enableTextureRecompression
|
||||||
|
ResScale = settings.resScale
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
var nativeHelpers = NativeHelpers()
|
var nativeHelpers = NativeHelpers()
|
||||||
@ -108,7 +114,6 @@ class GameHost(context: Context?, val controller: GameController, val mainViewMo
|
|||||||
window
|
window
|
||||||
)
|
)
|
||||||
|
|
||||||
var settings = QuickSettings(mainViewModel.activity)
|
|
||||||
|
|
||||||
success = _nativeRyujinx.deviceInitialize(
|
success = _nativeRyujinx.deviceInitialize(
|
||||||
settings.isHostMapped,
|
settings.isHostMapped,
|
||||||
@ -135,12 +140,6 @@ class GameHost(context: Context?, val controller: GameController, val mainViewMo
|
|||||||
);
|
);
|
||||||
|
|
||||||
_guestThread = thread(start = true) {
|
_guestThread = thread(start = true) {
|
||||||
runBlocking {
|
|
||||||
this.launch {
|
|
||||||
delay(5000)
|
|
||||||
_nativeRyujinx.graphicsRendererSetVsync(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runGame()
|
runGame()
|
||||||
}
|
}
|
||||||
_isStarted = success;
|
_isStarted = success;
|
||||||
|
@ -11,6 +11,9 @@ class QuickSettings(val activity: MainActivity) {
|
|||||||
var enableVsync: Boolean
|
var enableVsync: Boolean
|
||||||
var useNce: Boolean
|
var useNce: Boolean
|
||||||
var isHostMapped: Boolean
|
var isHostMapped: Boolean
|
||||||
|
var enableShaderCache: Boolean
|
||||||
|
var enableTextureRecompression: Boolean
|
||||||
|
var resScale : Float
|
||||||
|
|
||||||
private var sharedPref: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity)
|
private var sharedPref: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity)
|
||||||
|
|
||||||
@ -21,5 +24,8 @@ class QuickSettings(val activity: MainActivity) {
|
|||||||
enableDocked = sharedPref.getBoolean("enableDocked", true)
|
enableDocked = sharedPref.getBoolean("enableDocked", true)
|
||||||
enablePtc = sharedPref.getBoolean("enablePtc", true)
|
enablePtc = sharedPref.getBoolean("enablePtc", true)
|
||||||
ignoreMissingServices = sharedPref.getBoolean("ignoreMissingServices", false)
|
ignoreMissingServices = sharedPref.getBoolean("ignoreMissingServices", false)
|
||||||
|
enableShaderCache = sharedPref.getBoolean("enableShaderCache", true)
|
||||||
|
enableTextureRecompression = sharedPref.getBoolean("enableTextureRecompression", false)
|
||||||
|
resScale = sharedPref.getFloat("resScale", 1f)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,12 +17,17 @@ class SettingsViewModel(var navController: NavHostController, val activity: Main
|
|||||||
return PreferenceManager.getDefaultSharedPreferences(activity)
|
return PreferenceManager.getDefaultSharedPreferences(activity)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun initializeState(isHostMapped : MutableState<Boolean>,
|
fun initializeState(
|
||||||
useNce : MutableState<Boolean>,
|
isHostMapped: MutableState<Boolean>,
|
||||||
enableVsync : MutableState<Boolean>,
|
useNce: MutableState<Boolean>,
|
||||||
enableDocked : MutableState<Boolean>,
|
enableVsync: MutableState<Boolean>,
|
||||||
enablePtc : MutableState<Boolean>,
|
enableDocked: MutableState<Boolean>,
|
||||||
ignoreMissingServices : MutableState<Boolean>)
|
enablePtc: MutableState<Boolean>,
|
||||||
|
ignoreMissingServices: MutableState<Boolean>,
|
||||||
|
enableShaderCache: MutableState<Boolean>,
|
||||||
|
enableTextureRecompression: MutableState<Boolean>,
|
||||||
|
resScale: MutableState<Float>
|
||||||
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
isHostMapped.value = sharedPref.getBoolean("isHostMapped", true)
|
isHostMapped.value = sharedPref.getBoolean("isHostMapped", true)
|
||||||
@ -31,14 +36,22 @@ class SettingsViewModel(var navController: NavHostController, val activity: Main
|
|||||||
enableDocked.value = sharedPref.getBoolean("enableDocked", true)
|
enableDocked.value = sharedPref.getBoolean("enableDocked", true)
|
||||||
enablePtc.value = sharedPref.getBoolean("enablePtc", true)
|
enablePtc.value = sharedPref.getBoolean("enablePtc", true)
|
||||||
ignoreMissingServices.value = sharedPref.getBoolean("ignoreMissingServices", false)
|
ignoreMissingServices.value = sharedPref.getBoolean("ignoreMissingServices", false)
|
||||||
|
enableShaderCache.value = sharedPref.getBoolean("enableShaderCache", true)
|
||||||
|
enableTextureRecompression.value = sharedPref.getBoolean("enableTextureRecompression", false)
|
||||||
|
resScale.value = sharedPref.getFloat("resScale", 1f)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun save(isHostMapped : MutableState<Boolean>,
|
fun save(
|
||||||
useNce : MutableState<Boolean>,
|
isHostMapped: MutableState<Boolean>,
|
||||||
enableVsync : MutableState<Boolean>,
|
useNce: MutableState<Boolean>,
|
||||||
enableDocked : MutableState<Boolean>,
|
enableVsync: MutableState<Boolean>,
|
||||||
enablePtc : MutableState<Boolean>,
|
enableDocked: MutableState<Boolean>,
|
||||||
ignoreMissingServices : MutableState<Boolean>){
|
enablePtc: MutableState<Boolean>,
|
||||||
|
ignoreMissingServices: MutableState<Boolean>,
|
||||||
|
enableShaderCache: MutableState<Boolean>,
|
||||||
|
enableTextureRecompression: MutableState<Boolean>,
|
||||||
|
resScale: MutableState<Float>
|
||||||
|
){
|
||||||
var editor = sharedPref.edit()
|
var editor = sharedPref.edit()
|
||||||
|
|
||||||
editor.putBoolean("isHostMapped", isHostMapped?.value ?: true)
|
editor.putBoolean("isHostMapped", isHostMapped?.value ?: true)
|
||||||
@ -47,6 +60,9 @@ class SettingsViewModel(var navController: NavHostController, val activity: Main
|
|||||||
editor.putBoolean("enableDocked", enableDocked?.value ?: true)
|
editor.putBoolean("enableDocked", enableDocked?.value ?: true)
|
||||||
editor.putBoolean("enablePtc", enablePtc?.value ?: true)
|
editor.putBoolean("enablePtc", enablePtc?.value ?: true)
|
||||||
editor.putBoolean("ignoreMissingServices", ignoreMissingServices?.value ?: false)
|
editor.putBoolean("ignoreMissingServices", ignoreMissingServices?.value ?: false)
|
||||||
|
editor.putBoolean("enableShaderCache", enableShaderCache?.value ?: true)
|
||||||
|
editor.putBoolean("enableTextureRecompression", enableTextureRecompression?.value ?: false)
|
||||||
|
editor.putFloat("resScale", resScale?.value ?: 1f)
|
||||||
|
|
||||||
editor.apply()
|
editor.apply()
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package org.ryujinx.android.views
|
|||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import androidx.activity.compose.BackHandler
|
import androidx.activity.compose.BackHandler
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
import androidx.compose.animation.animateColor
|
|
||||||
import androidx.compose.animation.core.FastOutSlowInEasing
|
import androidx.compose.animation.core.FastOutSlowInEasing
|
||||||
import androidx.compose.animation.core.MutableTransitionState
|
import androidx.compose.animation.core.MutableTransitionState
|
||||||
import androidx.compose.animation.core.animateDp
|
import androidx.compose.animation.core.animateDp
|
||||||
@ -15,13 +14,10 @@ import androidx.compose.animation.fadeIn
|
|||||||
import androidx.compose.animation.fadeOut
|
import androidx.compose.animation.fadeOut
|
||||||
import androidx.compose.animation.shrinkVertically
|
import androidx.compose.animation.shrinkVertically
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.heightIn
|
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.ArrowBack
|
import androidx.compose.material.icons.filled.ArrowBack
|
||||||
@ -32,9 +28,9 @@ import androidx.compose.material3.Icon
|
|||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
|
import androidx.compose.material3.Slider
|
||||||
import androidx.compose.material3.Switch
|
import androidx.compose.material3.Switch
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextButton
|
|
||||||
import androidx.compose.material3.TopAppBar
|
import androidx.compose.material3.TopAppBar
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
@ -76,12 +72,24 @@ class SettingViews {
|
|||||||
var ignoreMissingServices = remember {
|
var ignoreMissingServices = remember {
|
||||||
mutableStateOf(false)
|
mutableStateOf(false)
|
||||||
}
|
}
|
||||||
|
var enableShaderCache = remember {
|
||||||
|
mutableStateOf(false)
|
||||||
|
}
|
||||||
|
var enableTextureRecompression = remember {
|
||||||
|
mutableStateOf(false)
|
||||||
|
}
|
||||||
|
var resScale = remember {
|
||||||
|
mutableStateOf(1f)
|
||||||
|
}
|
||||||
|
|
||||||
if (!loaded.value) {
|
if (!loaded.value) {
|
||||||
settingsViewModel.initializeState(
|
settingsViewModel.initializeState(
|
||||||
isHostMapped,
|
isHostMapped,
|
||||||
useNce,
|
useNce,
|
||||||
enableVsync, enableDocked, enablePtc, ignoreMissingServices
|
enableVsync, enableDocked, enablePtc, ignoreMissingServices,
|
||||||
|
enableShaderCache,
|
||||||
|
enableTextureRecompression,
|
||||||
|
resScale
|
||||||
)
|
)
|
||||||
loaded.value = true
|
loaded.value = true
|
||||||
}
|
}
|
||||||
@ -99,7 +107,10 @@ class SettingViews {
|
|||||||
enableVsync,
|
enableVsync,
|
||||||
enableDocked,
|
enableDocked,
|
||||||
enablePtc,
|
enablePtc,
|
||||||
ignoreMissingServices
|
ignoreMissingServices,
|
||||||
|
enableShaderCache,
|
||||||
|
enableTextureRecompression,
|
||||||
|
resScale
|
||||||
)
|
)
|
||||||
settingsViewModel.navController.popBackStack()
|
settingsViewModel.navController.popBackStack()
|
||||||
}) {
|
}) {
|
||||||
@ -111,7 +122,10 @@ class SettingViews {
|
|||||||
BackHandler {
|
BackHandler {
|
||||||
settingsViewModel.save(
|
settingsViewModel.save(
|
||||||
isHostMapped,
|
isHostMapped,
|
||||||
useNce, enableVsync, enableDocked, enablePtc, ignoreMissingServices
|
useNce, enableVsync, enableDocked, enablePtc, ignoreMissingServices,
|
||||||
|
enableShaderCache,
|
||||||
|
enableTextureRecompression,
|
||||||
|
resScale
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
ExpandableView(onCardArrowClick = { }, title = "System") {
|
ExpandableView(onCardArrowClick = { }, title = "System") {
|
||||||
@ -208,6 +222,59 @@ class SettingViews {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ExpandableView(onCardArrowClick = { }, title = "Graphics") {
|
||||||
|
Column(modifier = Modifier.fillMaxWidth()) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(8.dp),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = "Enable Shader Cache",
|
||||||
|
modifier = Modifier.align(Alignment.CenterVertically)
|
||||||
|
)
|
||||||
|
Switch(checked = enableShaderCache.value, onCheckedChange = {
|
||||||
|
enableShaderCache.value = !enableShaderCache.value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(8.dp),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = "Resolution Scale",
|
||||||
|
modifier = Modifier.align(Alignment.CenterVertically)
|
||||||
|
)
|
||||||
|
Text(text = resScale.value.toString() +"x")
|
||||||
|
}
|
||||||
|
Slider(value = resScale.value,
|
||||||
|
valueRange = 0.5f..4f,
|
||||||
|
steps = 6,
|
||||||
|
onValueChange = { it ->
|
||||||
|
resScale.value = it
|
||||||
|
} )
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(8.dp),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = "Enable Texture Recompression",
|
||||||
|
modifier = Modifier.align(Alignment.CenterVertically)
|
||||||
|
)
|
||||||
|
Switch(checked = enableTextureRecompression.value, onCheckedChange = {
|
||||||
|
enableTextureRecompression.value = !enableTextureRecompression.value
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -293,7 +360,9 @@ class SettingViews {
|
|||||||
Icon(
|
Icon(
|
||||||
Icons.Filled.KeyboardArrowUp,
|
Icons.Filled.KeyboardArrowUp,
|
||||||
contentDescription = "Expandable Arrow",
|
contentDescription = "Expandable Arrow",
|
||||||
modifier = Modifier.padding(8.dp).rotate(degrees),
|
modifier = Modifier
|
||||||
|
.padding(8.dp)
|
||||||
|
.rotate(degrees),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user