mirror of
https://git.ryujinx.app/kenji-nx/ryujinx.git
synced 2025-12-19 13:37:04 +00:00
misc: chore: Android: Tweak setting names, code
This commit is contained in:
parent
b22d771cce
commit
78b00e530c
17 changed files with 185 additions and 201 deletions
|
|
@ -8,6 +8,7 @@ import android.os.Environment
|
||||||
import android.provider.DocumentsContract
|
import android.provider.DocumentsContract
|
||||||
import android.provider.MediaStore
|
import android.provider.MediaStore
|
||||||
import androidx.compose.runtime.MutableState
|
import androidx.compose.runtime.MutableState
|
||||||
|
import androidx.core.net.toUri
|
||||||
import androidx.documentfile.provider.DocumentFile
|
import androidx.documentfile.provider.DocumentFile
|
||||||
import com.anggrayudi.storage.SimpleStorageHelper
|
import com.anggrayudi.storage.SimpleStorageHelper
|
||||||
import com.anggrayudi.storage.callback.FileCallback
|
import com.anggrayudi.storage.callback.FileCallback
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.core.net.toUri
|
||||||
import androidx.core.view.WindowCompat
|
import androidx.core.view.WindowCompat
|
||||||
import androidx.core.view.WindowInsetsCompat
|
import androidx.core.view.WindowInsetsCompat
|
||||||
import androidx.core.view.WindowInsetsControllerCompat
|
import androidx.core.view.WindowInsetsControllerCompat
|
||||||
|
|
@ -27,6 +28,7 @@ import org.kenjinx.android.viewmodels.GameModel
|
||||||
import org.kenjinx.android.views.MainView
|
import org.kenjinx.android.views.MainView
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
|
|
||||||
|
|
||||||
class MainActivity : BaseActivity() {
|
class MainActivity : BaseActivity() {
|
||||||
private var physicalControllerManager: PhysicalControllerManager =
|
private var physicalControllerManager: PhysicalControllerManager =
|
||||||
PhysicalControllerManager(this)
|
PhysicalControllerManager(this)
|
||||||
|
|
|
||||||
|
|
@ -6,18 +6,12 @@ import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.wrapContentHeight
|
|
||||||
import androidx.compose.foundation.layout.wrapContentWidth
|
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.text.KeyboardActions
|
import androidx.compose.foundation.text.KeyboardActions
|
||||||
import androidx.compose.foundation.text.KeyboardOptions
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material3.AlertDialogDefaults
|
|
||||||
import androidx.compose.material3.BasicAlertDialog
|
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.material3.Surface
|
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextField
|
import androidx.compose.material3.TextField
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ class DocumentProvider : DocumentsProvider() {
|
||||||
private fun copyDocument(
|
private fun copyDocument(
|
||||||
sourceDocumentId: String, sourceParentDocumentId: String,
|
sourceDocumentId: String, sourceParentDocumentId: String,
|
||||||
targetParentDocumentId: String?
|
targetParentDocumentId: String?
|
||||||
): String? {
|
): String {
|
||||||
if (!isChildDocument(sourceParentDocumentId, sourceDocumentId))
|
if (!isChildDocument(sourceParentDocumentId, sourceDocumentId))
|
||||||
throw FileNotFoundException("Couldn't copy document '$sourceDocumentId' as its parent is not '$sourceParentDocumentId'")
|
throw FileNotFoundException("Couldn't copy document '$sourceDocumentId' as its parent is not '$sourceParentDocumentId'")
|
||||||
|
|
||||||
|
|
@ -209,7 +209,7 @@ class DocumentProvider : DocumentsProvider() {
|
||||||
override fun moveDocument(
|
override fun moveDocument(
|
||||||
sourceDocumentId: String, sourceParentDocumentId: String?,
|
sourceDocumentId: String, sourceParentDocumentId: String?,
|
||||||
targetParentDocumentId: String?
|
targetParentDocumentId: String?
|
||||||
): String? {
|
): String {
|
||||||
try {
|
try {
|
||||||
val newDocumentId = copyDocument(
|
val newDocumentId = copyDocument(
|
||||||
sourceDocumentId, sourceParentDocumentId!!,
|
sourceDocumentId, sourceParentDocumentId!!,
|
||||||
|
|
@ -256,7 +256,7 @@ class DocumentProvider : DocumentsProvider() {
|
||||||
return cursor
|
return cursor
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getTypeForFile(file: File): Any? {
|
private fun getTypeForFile(file: File): Any {
|
||||||
return if (file.isDirectory)
|
return if (file.isDirectory)
|
||||||
DocumentsContract.Document.MIME_TYPE_DIR
|
DocumentsContract.Document.MIME_TYPE_DIR
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package org.kenjinx.android.viewmodels
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Environment
|
import android.os.Environment
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.runtime.MutableState
|
import androidx.compose.runtime.MutableState
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.snapshots.SnapshotStateList
|
import androidx.compose.runtime.snapshots.SnapshotStateList
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package org.kenjinx.android.viewmodels
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
|
import androidx.core.content.edit
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
|
|
||||||
class QuickSettings(val activity: Activity) {
|
class QuickSettings(val activity: Activity) {
|
||||||
|
|
@ -40,10 +41,10 @@ class QuickSettings(val activity: Activity) {
|
||||||
private var sharedPref: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity)
|
private var sharedPref: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
memoryManagerMode = MemoryManagerMode.values()[sharedPref.getInt("memoryManagerMode", MemoryManagerMode.HostMappedUnsafe.ordinal)]
|
memoryManagerMode = MemoryManagerMode.entries.toTypedArray()[sharedPref.getInt("memoryManagerMode", MemoryManagerMode.HostMappedUnsafe.ordinal)]
|
||||||
useNce = sharedPref.getBoolean("useNce", false)
|
useNce = sharedPref.getBoolean("useNce", false)
|
||||||
memoryConfiguration = MemoryConfiguration.values()[sharedPref.getInt("memoryConfiguration", MemoryConfiguration.MemoryConfiguration4GiB.ordinal)]
|
memoryConfiguration = MemoryConfiguration.entries.toTypedArray()[sharedPref.getInt("memoryConfiguration", MemoryConfiguration.MemoryConfiguration4GiB.ordinal)]
|
||||||
vSyncMode = VSyncMode.values()[sharedPref.getInt("vSyncMode", VSyncMode.Switch.ordinal)]
|
vSyncMode = VSyncMode.entries.toTypedArray()[sharedPref.getInt("vSyncMode", VSyncMode.Switch.ordinal)]
|
||||||
enableDocked = sharedPref.getBoolean("enableDocked", true)
|
enableDocked = sharedPref.getBoolean("enableDocked", true)
|
||||||
enablePptc = sharedPref.getBoolean("enablePptc", true)
|
enablePptc = sharedPref.getBoolean("enablePptc", true)
|
||||||
enableLowPowerPptc = sharedPref.getBoolean("enableLowPowerPptc", false)
|
enableLowPowerPptc = sharedPref.getBoolean("enableLowPowerPptc", false)
|
||||||
|
|
@ -74,53 +75,53 @@ class QuickSettings(val activity: Activity) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun save() {
|
fun save() {
|
||||||
val editor = sharedPref.edit()
|
sharedPref.edit {
|
||||||
|
|
||||||
editor.putInt("memoryManagerMode", memoryManagerMode.ordinal)
|
putInt("memoryManagerMode", memoryManagerMode.ordinal)
|
||||||
editor.putBoolean("useNce", useNce)
|
putBoolean("useNce", useNce)
|
||||||
editor.putInt("memoryConfiguration", memoryConfiguration.ordinal)
|
putInt("memoryConfiguration", memoryConfiguration.ordinal)
|
||||||
editor.putInt("vSyncMode", vSyncMode.ordinal)
|
putInt("vSyncMode", vSyncMode.ordinal)
|
||||||
editor.putBoolean("enableDocked", enableDocked)
|
putBoolean("enableDocked", enableDocked)
|
||||||
editor.putBoolean("enablePptc", enablePptc)
|
putBoolean("enablePptc", enablePptc)
|
||||||
editor.putBoolean("enableLowPowerPptc", enableLowPowerPptc)
|
putBoolean("enableLowPowerPptc", enableLowPowerPptc)
|
||||||
editor.putBoolean("enableJitCacheEviction", enableJitCacheEviction)
|
putBoolean("enableJitCacheEviction", enableJitCacheEviction)
|
||||||
editor.putBoolean("enableFsIntegrityChecks", enableFsIntegrityChecks)
|
putBoolean("enableFsIntegrityChecks", enableFsIntegrityChecks)
|
||||||
editor.putInt("fsGlobalAccessLogMode", fsGlobalAccessLogMode)
|
putInt("fsGlobalAccessLogMode", fsGlobalAccessLogMode)
|
||||||
editor.putBoolean("ignoreMissingServices", ignoreMissingServices)
|
putBoolean("ignoreMissingServices", ignoreMissingServices)
|
||||||
editor.putBoolean("enableShaderCache", enableShaderCache)
|
putBoolean("enableShaderCache", enableShaderCache)
|
||||||
editor.putBoolean("enableTextureRecompression", enableTextureRecompression)
|
putBoolean("enableTextureRecompression", enableTextureRecompression)
|
||||||
editor.putBoolean("enableMacroHLE",enableMacroHLE)
|
putBoolean("enableMacroHLE", enableMacroHLE)
|
||||||
editor.putFloat("resScale", resScale)
|
putFloat("resScale", resScale)
|
||||||
editor.putFloat("maxAnisotropy", maxAnisotropy)
|
putFloat("maxAnisotropy", maxAnisotropy)
|
||||||
editor.putBoolean("useVirtualController", useVirtualController)
|
putBoolean("useVirtualController", useVirtualController)
|
||||||
editor.putBoolean("isGrid", isGrid)
|
putBoolean("isGrid", isGrid)
|
||||||
editor.putBoolean("useSwitchLayout", useSwitchLayout)
|
putBoolean("useSwitchLayout", useSwitchLayout)
|
||||||
editor.putBoolean("enableMotion", enableMotion)
|
putBoolean("enableMotion", enableMotion)
|
||||||
editor.putBoolean("enablePerformanceMode", enablePerformanceMode)
|
putBoolean("enablePerformanceMode", enablePerformanceMode)
|
||||||
editor.putFloat("controllerStickSensitivity", controllerStickSensitivity)
|
putFloat("controllerStickSensitivity", controllerStickSensitivity)
|
||||||
editor.putBoolean("enableStubLogs", enableStubLogs)
|
putBoolean("enableStubLogs", enableStubLogs)
|
||||||
editor.putBoolean("enableInfoLogs", enableInfoLogs)
|
putBoolean("enableInfoLogs", enableInfoLogs)
|
||||||
editor.putBoolean("enableWarningLogs", enableWarningLogs)
|
putBoolean("enableWarningLogs", enableWarningLogs)
|
||||||
editor.putBoolean("enableErrorLogs", enableErrorLogs)
|
putBoolean("enableErrorLogs", enableErrorLogs)
|
||||||
editor.putBoolean("enableGuestLogs", enableGuestLogs)
|
putBoolean("enableGuestLogs", enableGuestLogs)
|
||||||
editor.putBoolean("enableFsAccessLogs", enableFsAccessLogs)
|
putBoolean("enableFsAccessLogs", enableFsAccessLogs)
|
||||||
editor.putBoolean("enableTraceLogs", enableTraceLogs)
|
putBoolean("enableTraceLogs", enableTraceLogs)
|
||||||
editor.putBoolean("enableDebugLogs", enableDebugLogs)
|
putBoolean("enableDebugLogs", enableDebugLogs)
|
||||||
editor.putBoolean("enableGraphicsLogs", enableGraphicsLogs)
|
putBoolean("enableGraphicsLogs", enableGraphicsLogs)
|
||||||
editor.apply()
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun overrideSettings(forceNceAndPptc: Boolean?)
|
fun overrideSettings(forceNceAndPptc: Boolean?)
|
||||||
{
|
{
|
||||||
if(forceNceAndPptc == true)
|
if(forceNceAndPptc == true)
|
||||||
{
|
{
|
||||||
enablePptc = true;
|
enablePptc = true
|
||||||
useNce = true;
|
useNce = true
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
enablePptc = false;
|
enablePptc = false
|
||||||
useNce = false;
|
useNce = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import java.io.BufferedOutputStream
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileOutputStream
|
import java.io.FileOutputStream
|
||||||
import kotlin.concurrent.thread
|
import kotlin.concurrent.thread
|
||||||
|
import androidx.core.content.edit
|
||||||
|
|
||||||
class SettingsViewModel(val activity: MainActivity) {
|
class SettingsViewModel(val activity: MainActivity) {
|
||||||
var selectedFirmwareVersion: String = ""
|
var selectedFirmwareVersion: String = ""
|
||||||
|
|
@ -31,6 +32,14 @@ class SettingsViewModel(val activity: MainActivity) {
|
||||||
sharedPref = getPreferences()
|
sharedPref = getPreferences()
|
||||||
previousFolderCallback = activity.storageHelper!!.onFolderSelected
|
previousFolderCallback = activity.storageHelper!!.onFolderSelected
|
||||||
previousFileCallback = activity.storageHelper!!.onFileSelected
|
previousFileCallback = activity.storageHelper!!.onFileSelected
|
||||||
|
activity.storageHelper!!.onFolderSelected = { _, folder ->
|
||||||
|
run {
|
||||||
|
val p = folder.getAbsolutePath(activity)
|
||||||
|
sharedPref.edit {
|
||||||
|
this.putString("gameFolder", p)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getPreferences(): SharedPreferences {
|
private fun getPreferences(): SharedPreferences {
|
||||||
|
|
@ -70,10 +79,10 @@ class SettingsViewModel(val activity: MainActivity) {
|
||||||
enableDebugLogs: MutableState<Boolean>,
|
enableDebugLogs: MutableState<Boolean>,
|
||||||
enableGraphicsLogs: MutableState<Boolean>
|
enableGraphicsLogs: MutableState<Boolean>
|
||||||
) {
|
) {
|
||||||
memoryManagerMode.value = MemoryManagerMode.values()[sharedPref.getInt("memoryManagerMode", MemoryManagerMode.HostMappedUnsafe.ordinal)]
|
memoryManagerMode.value = MemoryManagerMode.entries.toTypedArray()[sharedPref.getInt("memoryManagerMode", MemoryManagerMode.HostMappedUnsafe.ordinal)]
|
||||||
useNce.value = sharedPref.getBoolean("useNce", false)
|
useNce.value = sharedPref.getBoolean("useNce", false)
|
||||||
memoryConfiguration.value = MemoryConfiguration.values()[sharedPref.getInt("memoryConfiguration", MemoryConfiguration.MemoryConfiguration4GiB.ordinal)]
|
memoryConfiguration.value = MemoryConfiguration.entries.toTypedArray()[sharedPref.getInt("memoryConfiguration", MemoryConfiguration.MemoryConfiguration4GiB.ordinal)]
|
||||||
vSyncMode.value = VSyncMode.values()[sharedPref.getInt("vSyncMode", VSyncMode.Switch.ordinal)]
|
vSyncMode.value = VSyncMode.entries.toTypedArray()[sharedPref.getInt("vSyncMode", VSyncMode.Switch.ordinal)]
|
||||||
enableDocked.value = sharedPref.getBoolean("enableDocked", true)
|
enableDocked.value = sharedPref.getBoolean("enableDocked", true)
|
||||||
enablePptc.value = sharedPref.getBoolean("enablePptc", true)
|
enablePptc.value = sharedPref.getBoolean("enablePptc", true)
|
||||||
enableLowPowerPptc.value = sharedPref.getBoolean("enableLowPowerPptc", false)
|
enableLowPowerPptc.value = sharedPref.getBoolean("enableLowPowerPptc", false)
|
||||||
|
|
@ -136,41 +145,42 @@ class SettingsViewModel(val activity: MainActivity) {
|
||||||
enableDebugLogs: MutableState<Boolean>,
|
enableDebugLogs: MutableState<Boolean>,
|
||||||
enableGraphicsLogs: MutableState<Boolean>
|
enableGraphicsLogs: MutableState<Boolean>
|
||||||
) {
|
) {
|
||||||
val editor = sharedPref.edit()
|
sharedPref.edit {
|
||||||
|
|
||||||
editor.putInt("memoryManagerMode", memoryManagerMode.value.ordinal)
|
putInt("memoryManagerMode", memoryManagerMode.value.ordinal)
|
||||||
editor.putBoolean("useNce", useNce.value)
|
putBoolean("useNce", useNce.value)
|
||||||
editor.putInt("memoryConfiguration", memoryConfiguration.value.ordinal)
|
putInt("memoryConfiguration", memoryConfiguration.value.ordinal)
|
||||||
editor.putInt("vSyncMode", vSyncMode.value.ordinal)
|
putInt("vSyncMode", vSyncMode.value.ordinal)
|
||||||
editor.putBoolean("enableDocked", enableDocked.value)
|
putBoolean("enableDocked", enableDocked.value)
|
||||||
editor.putBoolean("enablePptc", enablePptc.value)
|
putBoolean("enablePptc", enablePptc.value)
|
||||||
editor.putBoolean("enableLowPowerPptc", enableLowPowerPptc.value)
|
putBoolean("enableLowPowerPptc", enableLowPowerPptc.value)
|
||||||
editor.putBoolean("enableJitCacheEviction", enableJitCacheEviction.value)
|
putBoolean("enableJitCacheEviction", enableJitCacheEviction.value)
|
||||||
editor.putBoolean("enableFsIntegrityChecks", enableFsIntegrityChecks.value)
|
putBoolean("enableFsIntegrityChecks", enableFsIntegrityChecks.value)
|
||||||
editor.putInt("fsGlobalAccessLogMode", fsGlobalAccessLogMode.value)
|
putInt("fsGlobalAccessLogMode", fsGlobalAccessLogMode.value)
|
||||||
editor.putBoolean("ignoreMissingServices", ignoreMissingServices.value)
|
putBoolean("ignoreMissingServices", ignoreMissingServices.value)
|
||||||
editor.putBoolean("enableShaderCache", enableShaderCache.value)
|
putBoolean("enableShaderCache", enableShaderCache.value)
|
||||||
editor.putBoolean("enableTextureRecompression", enableTextureRecompression.value)
|
putBoolean("enableTextureRecompression", enableTextureRecompression.value)
|
||||||
editor.putBoolean("enableMacroHLE", enableMacroHLE.value)
|
putBoolean("enableMacroHLE", enableMacroHLE.value)
|
||||||
editor.putFloat("resScale", resScale.value)
|
putFloat("resScale", resScale.value)
|
||||||
editor.putFloat("maxAnisotropy", maxAnisotropy.value)
|
putFloat("maxAnisotropy", maxAnisotropy.value)
|
||||||
editor.putBoolean("useVirtualController", useVirtualController.value)
|
putBoolean("useVirtualController", useVirtualController.value)
|
||||||
editor.putBoolean("isGrid", isGrid.value)
|
putBoolean("isGrid", isGrid.value)
|
||||||
editor.putBoolean("useSwitchLayout", useSwitchLayout.value)
|
putBoolean("useSwitchLayout", useSwitchLayout.value)
|
||||||
editor.putBoolean("enableMotion", enableMotion.value)
|
putBoolean("enableMotion", enableMotion.value)
|
||||||
editor.putBoolean("enablePerformanceMode", enablePerformanceMode.value)
|
putBoolean("enablePerformanceMode", enablePerformanceMode.value)
|
||||||
editor.putFloat("controllerStickSensitivity", controllerStickSensitivity.value)
|
putFloat("controllerStickSensitivity", controllerStickSensitivity.value)
|
||||||
editor.putBoolean("enableStubLogs", enableStubLogs.value)
|
putBoolean("enableStubLogs", enableStubLogs.value)
|
||||||
editor.putBoolean("enableInfoLogs", enableInfoLogs.value)
|
putBoolean("enableInfoLogs", enableInfoLogs.value)
|
||||||
editor.putBoolean("enableWarningLogs", enableWarningLogs.value)
|
putBoolean("enableWarningLogs", enableWarningLogs.value)
|
||||||
editor.putBoolean("enableErrorLogs", enableErrorLogs.value)
|
putBoolean("enableErrorLogs", enableErrorLogs.value)
|
||||||
editor.putBoolean("enableGuestLogs", enableGuestLogs.value)
|
putBoolean("enableGuestLogs", enableGuestLogs.value)
|
||||||
editor.putBoolean("enableFsAccessLogs", enableFsAccessLogs.value)
|
putBoolean("enableFsAccessLogs", enableFsAccessLogs.value)
|
||||||
editor.putBoolean("enableTraceLogs", enableTraceLogs.value)
|
putBoolean("enableTraceLogs", enableTraceLogs.value)
|
||||||
editor.putBoolean("enableDebugLogs", enableDebugLogs.value)
|
putBoolean("enableDebugLogs", enableDebugLogs.value)
|
||||||
editor.putBoolean("enableGraphicsLogs", enableGraphicsLogs.value)
|
putBoolean("enableGraphicsLogs", enableGraphicsLogs.value)
|
||||||
|
|
||||||
editor.apply()
|
}
|
||||||
|
activity.storageHelper!!.onFolderSelected = previousFolderCallback
|
||||||
|
|
||||||
KenjinxNative.loggingSetEnabled(LogLevel.Info, enableInfoLogs.value)
|
KenjinxNative.loggingSetEnabled(LogLevel.Info, enableInfoLogs.value)
|
||||||
KenjinxNative.loggingSetEnabled(LogLevel.Stub, enableStubLogs.value)
|
KenjinxNative.loggingSetEnabled(LogLevel.Stub, enableStubLogs.value)
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import androidx.compose.runtime.MutableState
|
||||||
import androidx.compose.runtime.snapshots.SnapshotStateList
|
import androidx.compose.runtime.snapshots.SnapshotStateList
|
||||||
import androidx.compose.ui.text.intl.Locale
|
import androidx.compose.ui.text.intl.Locale
|
||||||
import androidx.compose.ui.text.toLowerCase
|
import androidx.compose.ui.text.toLowerCase
|
||||||
|
import androidx.core.net.toUri
|
||||||
import com.anggrayudi.storage.SimpleStorageHelper
|
import com.anggrayudi.storage.SimpleStorageHelper
|
||||||
import com.anggrayudi.storage.file.extension
|
import com.anggrayudi.storage.file.extension
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
|
|
@ -39,7 +40,7 @@ class TitleUpdateViewModel(val titleId: String) {
|
||||||
pathsState?.clear()
|
pathsState?.clear()
|
||||||
pathsState?.addAll(updatesData.paths)
|
pathsState?.addAll(updatesData.paths)
|
||||||
|
|
||||||
Uri.parse(str)?.let { uri ->
|
str.toUri().let { uri ->
|
||||||
try {
|
try {
|
||||||
storageHelper.storage.context.contentResolver.releasePersistableUriPermission(
|
storageHelper.storage.context.contentResolver.releasePersistableUriPermission(
|
||||||
uri,
|
uri,
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.MutableState
|
import androidx.compose.runtime.MutableState
|
||||||
import androidx.compose.runtime.derivedStateOf
|
import androidx.compose.runtime.derivedStateOf
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.snapshots.SnapshotStateList
|
import androidx.compose.runtime.snapshots.SnapshotStateList
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
|
|
@ -73,7 +72,7 @@ class DlcViews {
|
||||||
}
|
}
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
Column {
|
Column {
|
||||||
Text(text = "DLC for ${name}", textAlign = TextAlign.Center)
|
Text(text = "DLC for $name", textAlign = TextAlign.Center)
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(8.dp)
|
.padding(8.dp)
|
||||||
|
|
|
||||||
|
|
@ -7,20 +7,15 @@ 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.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.itemsIndexed
|
|
||||||
import androidx.compose.material3.Card
|
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
import androidx.compose.material3.LinearProgressIndicator
|
|
||||||
import androidx.compose.material3.LocalTextStyle
|
import androidx.compose.material3.LocalTextStyle
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Switch
|
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
|
|
@ -310,10 +305,10 @@ class GameViews {
|
||||||
CompositionLocalProvider(LocalTextStyle provides TextStyle(fontSize = 10.sp)) {
|
CompositionLocalProvider(LocalTextStyle provides TextStyle(fontSize = 10.sp)) {
|
||||||
Column {
|
Column {
|
||||||
var gameTimeVal = 0.0
|
var gameTimeVal = 0.0
|
||||||
if (!gameTime.value.isInfinite())
|
if (!gameTime.doubleValue.isInfinite())
|
||||||
gameTimeVal = gameTime.value
|
gameTimeVal = gameTime.doubleValue
|
||||||
Text(text = "${String.format("%.3f", fifo.value)} %")
|
Text(text = "${String.format("%.3f", fifo.doubleValue)} %")
|
||||||
Text(text = "${String.format("%.3f", gameFps.value)} FPS")
|
Text(text = "${String.format("%.3f", gameFps.doubleValue)} FPS")
|
||||||
Text(text = "${String.format("%.3f", gameTimeVal)} ms")
|
Text(text = "${String.format("%.3f", gameTimeVal)} ms")
|
||||||
Box(modifier = Modifier.width(96.dp)) {
|
Box(modifier = Modifier.width(96.dp)) {
|
||||||
Column {
|
Column {
|
||||||
|
|
@ -335,12 +330,12 @@ class GameViews {
|
||||||
Row {
|
Row {
|
||||||
Text(modifier = Modifier.padding(2.dp), text = "Used")
|
Text(modifier = Modifier.padding(2.dp), text = "Used")
|
||||||
Spacer(Modifier.weight(1f))
|
Spacer(Modifier.weight(1f))
|
||||||
Text(text = "${usedMem.value} MB")
|
Text(text = "${usedMem.intValue} MB")
|
||||||
}
|
}
|
||||||
Row {
|
Row {
|
||||||
Text(modifier = Modifier.padding(2.dp), text = "Total")
|
Text(modifier = Modifier.padding(2.dp), text = "Total")
|
||||||
Spacer(Modifier.weight(1f))
|
Spacer(Modifier.weight(1f))
|
||||||
Text(text = "${totalMem.value} MB")
|
Text(text = "${totalMem.intValue} MB")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,8 @@ import androidx.compose.material3.Slider
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TopAppBar
|
import androidx.compose.material3.TopAppBar
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.mutableFloatStateOf
|
||||||
|
import androidx.compose.runtime.mutableIntStateOf
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
|
|
@ -95,13 +97,13 @@ class SettingViews {
|
||||||
val enableLowPowerPptc = remember { mutableStateOf(false) }
|
val enableLowPowerPptc = remember { mutableStateOf(false) }
|
||||||
val enableJitCacheEviction = remember { mutableStateOf(false) }
|
val enableJitCacheEviction = remember { mutableStateOf(false) }
|
||||||
var enableFsIntegrityChecks = remember { mutableStateOf(false) }
|
var enableFsIntegrityChecks = remember { mutableStateOf(false) }
|
||||||
var fsGlobalAccessLogMode = remember { mutableStateOf(0) }
|
var fsGlobalAccessLogMode = remember { mutableIntStateOf(0) }
|
||||||
val ignoreMissingServices = remember { mutableStateOf(false) }
|
val ignoreMissingServices = remember { mutableStateOf(false) }
|
||||||
val enableShaderCache = remember { mutableStateOf(false) }
|
val enableShaderCache = remember { mutableStateOf(false) }
|
||||||
val enableTextureRecompression = remember { mutableStateOf(false) }
|
val enableTextureRecompression = remember { mutableStateOf(false) }
|
||||||
val enableMacroHLE = remember { mutableStateOf(false) }
|
val enableMacroHLE = remember { mutableStateOf(false) }
|
||||||
val resScale = remember { mutableStateOf(1f) }
|
val resScale = remember { mutableFloatStateOf(1f) }
|
||||||
val maxAnisotropy = remember { mutableStateOf(0f) }
|
val maxAnisotropy = remember { mutableFloatStateOf(0f) }
|
||||||
val useVirtualController = remember { mutableStateOf(true) }
|
val useVirtualController = remember { mutableStateOf(true) }
|
||||||
val showKeyDialog = remember { mutableStateOf(false) }
|
val showKeyDialog = remember { mutableStateOf(false) }
|
||||||
val keyInstallState = remember { mutableStateOf(KeyInstallState.File) }
|
val keyInstallState = remember { mutableStateOf(KeyInstallState.File) }
|
||||||
|
|
@ -117,7 +119,7 @@ class SettingViews {
|
||||||
val useSwitchLayout = remember { mutableStateOf(true) }
|
val useSwitchLayout = remember { mutableStateOf(true) }
|
||||||
val enableMotion = remember { mutableStateOf(true) }
|
val enableMotion = remember { mutableStateOf(true) }
|
||||||
val enablePerformanceMode = remember { mutableStateOf(true) }
|
val enablePerformanceMode = remember { mutableStateOf(true) }
|
||||||
val controllerStickSensitivity = remember { mutableStateOf(1.0f) }
|
val controllerStickSensitivity = remember { mutableFloatStateOf(1.0f) }
|
||||||
val enableStubLogs = remember { mutableStateOf(true) }
|
val enableStubLogs = remember { mutableStateOf(true) }
|
||||||
val enableInfoLogs = remember { mutableStateOf(true) }
|
val enableInfoLogs = remember { mutableStateOf(true) }
|
||||||
val enableWarningLogs = remember { mutableStateOf(true) }
|
val enableWarningLogs = remember { mutableStateOf(true) }
|
||||||
|
|
@ -578,7 +580,6 @@ class SettingViews {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -803,7 +804,6 @@ class SettingViews {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1116,8 +1116,8 @@ class SettingViews {
|
||||||
text = "Controller Stick Sensitivity",
|
text = "Controller Stick Sensitivity",
|
||||||
modifier = Modifier.align(Alignment.CenterVertically)
|
modifier = Modifier.align(Alignment.CenterVertically)
|
||||||
)
|
)
|
||||||
Slider(modifier = Modifier.width(250.dp), value = controllerStickSensitivity.value, onValueChange = {
|
Slider(modifier = Modifier.width(250.dp), value = controllerStickSensitivity.floatValue, onValueChange = {
|
||||||
controllerStickSensitivity.value = it
|
controllerStickSensitivity.floatValue = it
|
||||||
}, valueRange = 0.1f..2f,
|
}, valueRange = 0.1f..2f,
|
||||||
steps = 20,
|
steps = 20,
|
||||||
interactionSource = interactionSource,
|
interactionSource = interactionSource,
|
||||||
|
|
@ -1127,7 +1127,7 @@ class SettingViews {
|
||||||
PlainTooltip(modifier = Modifier
|
PlainTooltip(modifier = Modifier
|
||||||
.sizeIn(45.dp, 25.dp)
|
.sizeIn(45.dp, 25.dp)
|
||||||
.wrapContentWidth()) {
|
.wrapContentWidth()) {
|
||||||
Text("%.2f".format(controllerStickSensitivity.value))
|
Text("%.2f".format(controllerStickSensitivity.floatValue))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
interactionSource = interactionSource
|
interactionSource = interactionSource
|
||||||
|
|
@ -1169,12 +1169,12 @@ class SettingViews {
|
||||||
enablePerformanceMode.SwitchSelector(label = "Performance Mode")
|
enablePerformanceMode.SwitchSelector(label = "Performance Mode")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ExpandableView(onCardArrowClick = { }, title = "Cpu", icon = Icons.Outlined.Memory) {
|
ExpandableView(onCardArrowClick = { }, title = "CPU", icon = Icons.Outlined.Memory) {
|
||||||
Column(modifier = Modifier.fillMaxWidth()) {
|
Column(modifier = Modifier.fillMaxWidth()) {
|
||||||
useNce.SwitchSelector(label = "Enable NCE (Native Code Execution)")
|
useNce.SwitchSelector(label = "NCE (Native Code Execution)")
|
||||||
enablePptc.SwitchSelector(label = "Enable PPTC (Profiled Persistent Translation Cache)")
|
enablePptc.SwitchSelector(label = "PPTC (Profiled Persistent Translation Cache)")
|
||||||
enableLowPowerPptc.SwitchSelector(label = "Enable Low-Power PPTC")
|
enableLowPowerPptc.SwitchSelector(label = "Low-Power PPTC")
|
||||||
enableJitCacheEviction.SwitchSelector(label = "Enable Jit Cache Eviction")
|
enableJitCacheEviction.SwitchSelector(label = "Jit Cache Eviction")
|
||||||
MemoryModeDropdown(
|
MemoryModeDropdown(
|
||||||
selectedMemoryManagerMode = memoryManagerMode.value,
|
selectedMemoryManagerMode = memoryManagerMode.value,
|
||||||
onModeSelected = { mode ->
|
onModeSelected = { mode ->
|
||||||
|
|
@ -1185,19 +1185,19 @@ class SettingViews {
|
||||||
}
|
}
|
||||||
ExpandableView(onCardArrowClick = { }, title = "Graphics", icon = Icons.Outlined.Panorama) {
|
ExpandableView(onCardArrowClick = { }, title = "Graphics", icon = Icons.Outlined.Panorama) {
|
||||||
Column(modifier = Modifier.fillMaxWidth()) {
|
Column(modifier = Modifier.fillMaxWidth()) {
|
||||||
enableShaderCache.SwitchSelector(label = "Enable Shader Cache")
|
enableShaderCache.SwitchSelector(label = "Shader Cache")
|
||||||
enableTextureRecompression.SwitchSelector(label = "Enable Texture Recompression")
|
enableTextureRecompression.SwitchSelector(label = "Texture Recompression")
|
||||||
enableMacroHLE.SwitchSelector(label = "Enable Macro HLE")
|
enableMacroHLE.SwitchSelector(label = "Macro HLE")
|
||||||
ResolutionScaleDropdown(
|
ResolutionScaleDropdown(
|
||||||
selectedScale = resScale.value,
|
selectedScale = resScale.floatValue,
|
||||||
onScaleSelected = { scale ->
|
onScaleSelected = { scale ->
|
||||||
resScale.value = scale
|
resScale.floatValue = scale
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
AnisotropicFilteringDropdown(
|
AnisotropicFilteringDropdown(
|
||||||
selectedAnisotropy = maxAnisotropy.value,
|
selectedAnisotropy = maxAnisotropy.floatValue,
|
||||||
onAnisotropySelected = { anisotropy ->
|
onAnisotropySelected = { anisotropy ->
|
||||||
maxAnisotropy.value = anisotropy
|
maxAnisotropy.floatValue = anisotropy
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -1234,19 +1234,19 @@ class SettingViews {
|
||||||
|
|
||||||
ExpandableView(onCardArrowClick = { }, title = "Logging", icon = Icons.Outlined.FileOpen) {
|
ExpandableView(onCardArrowClick = { }, title = "Logging", icon = Icons.Outlined.FileOpen) {
|
||||||
Column(modifier = Modifier.fillMaxWidth()) {
|
Column(modifier = Modifier.fillMaxWidth()) {
|
||||||
enableStubLogs.SwitchSelector(label = "Enable Stub Logs")
|
enableStubLogs.SwitchSelector(label = "Stub Logs")
|
||||||
enableInfoLogs.SwitchSelector(label = "Enable Info Logs")
|
enableInfoLogs.SwitchSelector(label = "Info Logs")
|
||||||
enableWarningLogs.SwitchSelector(label = "Enable Warning Logs")
|
enableWarningLogs.SwitchSelector(label = "Warning Logs")
|
||||||
enableErrorLogs.SwitchSelector(label = "Enable Error Logs")
|
enableErrorLogs.SwitchSelector(label = "Error Logs")
|
||||||
enableGuestLogs.SwitchSelector(label = "Enable Guest Logs")
|
enableGuestLogs.SwitchSelector(label = "Guest Logs")
|
||||||
enableTraceLogs.SwitchSelector(label = "Enable Trace Logs")
|
enableTraceLogs.SwitchSelector(label = "Trace Logs")
|
||||||
enableFsAccessLogs.SwitchSelector(label = "Enable Fs Access Logs")
|
enableFsAccessLogs.SwitchSelector(label = "Fs Access Logs")
|
||||||
enableDebugLogs.SwitchSelector(label = "Enable Debug Logs")
|
enableDebugLogs.SwitchSelector(label = "Debug Logs")
|
||||||
enableGraphicsLogs.SwitchSelector(label = "Enable Graphics Logs")
|
enableGraphicsLogs.SwitchSelector(label = "Graphics Logs")
|
||||||
FsGlobalAccessLogModeDropdown(
|
FsGlobalAccessLogModeDropdown(
|
||||||
selectedFsGlobalAccess = fsGlobalAccessLogMode.value,
|
selectedFsGlobalAccess = fsGlobalAccessLogMode.intValue,
|
||||||
onFsGlobalAccessSelected = { fsGlobalAccess ->
|
onFsGlobalAccessSelected = { fsGlobalAccess ->
|
||||||
fsGlobalAccessLogMode.value = fsGlobalAccess
|
fsGlobalAccessLogMode.intValue = fsGlobalAccess
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -1276,10 +1276,9 @@ class SettingViews {
|
||||||
@Composable
|
@Composable
|
||||||
fun MemoryModeDropdown(
|
fun MemoryModeDropdown(
|
||||||
selectedMemoryManagerMode: MemoryManagerMode,
|
selectedMemoryManagerMode: MemoryManagerMode,
|
||||||
onModeSelected: (MemoryManagerMode) -> Unit,
|
onModeSelected: (MemoryManagerMode) -> Unit
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
val modes = MemoryManagerMode.values()
|
val modes = MemoryManagerMode.entries.toTypedArray()
|
||||||
|
|
||||||
DropdownSelector(
|
DropdownSelector(
|
||||||
label = "Memory Manager Mode",
|
label = "Memory Manager Mode",
|
||||||
|
|
@ -1292,18 +1291,16 @@ class SettingViews {
|
||||||
MemoryManagerMode.HostMappedUnsafe -> "Host Unchecked (fastest, unsafe)"
|
MemoryManagerMode.HostMappedUnsafe -> "Host Unchecked (fastest, unsafe)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onOptionSelected = onModeSelected,
|
onOptionSelected = onModeSelected
|
||||||
modifier = modifier
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun VSyncDropdown(
|
fun VSyncDropdown(
|
||||||
selectedVSyncMode: VSyncMode,
|
selectedVSyncMode: VSyncMode,
|
||||||
onModeSelected: (VSyncMode) -> Unit,
|
onModeSelected: (VSyncMode) -> Unit
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
val modes = VSyncMode.values()
|
val modes = VSyncMode.entries.toTypedArray()
|
||||||
|
|
||||||
DropdownSelector(
|
DropdownSelector(
|
||||||
label = "VSync",
|
label = "VSync",
|
||||||
|
|
@ -1315,42 +1312,38 @@ class SettingViews {
|
||||||
VSyncMode.Unbounded -> "Unbounded"
|
VSyncMode.Unbounded -> "Unbounded"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onOptionSelected = onModeSelected,
|
onOptionSelected = onModeSelected
|
||||||
modifier = modifier
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun MemoryDropdown(
|
fun MemoryDropdown(
|
||||||
selectedMemoryConfiguration: MemoryConfiguration,
|
selectedMemoryConfiguration: MemoryConfiguration,
|
||||||
onConfigurationSelected: (MemoryConfiguration) -> Unit,
|
onConfigurationSelected: (MemoryConfiguration) -> Unit
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
val modes = MemoryConfiguration.values()
|
val modes = MemoryConfiguration.entries.toTypedArray()
|
||||||
|
|
||||||
DropdownSelector(
|
DropdownSelector(
|
||||||
label = "Dram Size",
|
label = "DRAM Size",
|
||||||
selectedValue = selectedMemoryConfiguration,
|
selectedValue = selectedMemoryConfiguration,
|
||||||
options = modes.toList(),
|
options = modes.toList(),
|
||||||
getDisplayText = { configuration ->
|
getDisplayText = { configuration ->
|
||||||
when(configuration) {
|
when(configuration) {
|
||||||
MemoryConfiguration.MemoryConfiguration4GiB -> "4GB"
|
MemoryConfiguration.MemoryConfiguration4GiB -> "4GiB"
|
||||||
MemoryConfiguration.MemoryConfiguration6GiB -> "6GB"
|
MemoryConfiguration.MemoryConfiguration6GiB -> "6GiB"
|
||||||
MemoryConfiguration.MemoryConfiguration8GiB -> "8GB"
|
MemoryConfiguration.MemoryConfiguration8GiB -> "8GiB"
|
||||||
MemoryConfiguration.MemoryConfiguration10GiB -> "10GB"
|
MemoryConfiguration.MemoryConfiguration10GiB -> "10GiB"
|
||||||
MemoryConfiguration.MemoryConfiguration12GiB -> "12GB"
|
MemoryConfiguration.MemoryConfiguration12GiB -> "12GiB"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onOptionSelected = onConfigurationSelected,
|
onOptionSelected = onConfigurationSelected
|
||||||
modifier = modifier
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ResolutionScaleDropdown(
|
fun ResolutionScaleDropdown(
|
||||||
selectedScale: Float,
|
selectedScale: Float,
|
||||||
onScaleSelected: (Float) -> Unit,
|
onScaleSelected: (Float) -> Unit
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
val scaleOptions = listOf(
|
val scaleOptions = listOf(
|
||||||
0.5f to "0.5x (360p/540p)",
|
0.5f to "0.5x (360p/540p)",
|
||||||
|
|
@ -1367,16 +1360,14 @@ class SettingViews {
|
||||||
getDisplayText = { scale ->
|
getDisplayText = { scale ->
|
||||||
scaleOptions.find { it.first == scale }?.second ?: "${scale}x"
|
scaleOptions.find { it.first == scale }?.second ?: "${scale}x"
|
||||||
},
|
},
|
||||||
onOptionSelected = onScaleSelected,
|
onOptionSelected = onScaleSelected
|
||||||
modifier = modifier
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AnisotropicFilteringDropdown(
|
fun AnisotropicFilteringDropdown(
|
||||||
selectedAnisotropy: Float,
|
selectedAnisotropy: Float,
|
||||||
onAnisotropySelected: (Float) -> Unit,
|
onAnisotropySelected: (Float) -> Unit
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
val anisotropyOptions = listOf(
|
val anisotropyOptions = listOf(
|
||||||
0.0f to "0x",
|
0.0f to "0x",
|
||||||
|
|
@ -1393,16 +1384,14 @@ class SettingViews {
|
||||||
getDisplayText = { anisotropy ->
|
getDisplayText = { anisotropy ->
|
||||||
anisotropyOptions.find { it.first == anisotropy }?.second ?: "${anisotropy}x"
|
anisotropyOptions.find { it.first == anisotropy }?.second ?: "${anisotropy}x"
|
||||||
},
|
},
|
||||||
onOptionSelected = onAnisotropySelected,
|
onOptionSelected = onAnisotropySelected
|
||||||
modifier = modifier
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun FsGlobalAccessLogModeDropdown(
|
fun FsGlobalAccessLogModeDropdown(
|
||||||
selectedFsGlobalAccess: Int,
|
selectedFsGlobalAccess: Int,
|
||||||
onFsGlobalAccessSelected: (Int) -> Unit,
|
onFsGlobalAccessSelected: (Int) -> Unit
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
val fsGlobalAccessOptions = listOf(
|
val fsGlobalAccessOptions = listOf(
|
||||||
0 to "0",
|
0 to "0",
|
||||||
|
|
@ -1418,8 +1407,7 @@ class SettingViews {
|
||||||
getDisplayText = { fsGlobalAccess ->
|
getDisplayText = { fsGlobalAccess ->
|
||||||
fsGlobalAccessOptions.find { it.first == fsGlobalAccess }?.second ?: "${fsGlobalAccess}x"
|
fsGlobalAccessOptions.find { it.first == fsGlobalAccess }?.second ?: "${fsGlobalAccess}x"
|
||||||
},
|
},
|
||||||
onOptionSelected = onFsGlobalAccessSelected,
|
onOptionSelected = onFsGlobalAccessSelected
|
||||||
modifier = modifier
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.MutableState
|
import androidx.compose.runtime.MutableState
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableIntStateOf
|
||||||
import androidx.compose.runtime.mutableStateListOf
|
import androidx.compose.runtime.mutableStateListOf
|
||||||
import androidx.compose.runtime.mutableStateOf
|
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
|
|
@ -44,7 +44,7 @@ class TitleUpdateViews {
|
||||||
fun Main(titleId: String, name: String, openDialog: MutableState<Boolean>, canClose: MutableState<Boolean>) {
|
fun Main(titleId: String, name: String, openDialog: MutableState<Boolean>, canClose: MutableState<Boolean>) {
|
||||||
val viewModel = TitleUpdateViewModel(titleId)
|
val viewModel = TitleUpdateViewModel(titleId)
|
||||||
|
|
||||||
var selectedIndex by remember { mutableStateOf(0) }
|
var selectedIndex by remember { mutableIntStateOf(0) }
|
||||||
viewModel.data?.apply {
|
viewModel.data?.apply {
|
||||||
selectedIndex = paths.indexOf(this.selected) + 1
|
selectedIndex = paths.indexOf(this.selected) + 1
|
||||||
}
|
}
|
||||||
|
|
@ -85,7 +85,7 @@ class TitleUpdateViews {
|
||||||
}
|
}
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
Column {
|
Column {
|
||||||
Text(text = "Updates for ${name}", textAlign = TextAlign.Center)
|
Text(text = "Updates for $name", textAlign = TextAlign.Center)
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(8.dp)
|
.padding(8.dp)
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ class UserViews {
|
||||||
val isNavigating = remember { mutableStateOf(false) }
|
val isNavigating = remember { mutableStateOf(false) }
|
||||||
|
|
||||||
fun refresh() {
|
fun refresh() {
|
||||||
viewModel?.userViewModel?.refreshUsers()
|
viewModel.userViewModel.refreshUsers()
|
||||||
reload.value = true
|
reload.value = true
|
||||||
}
|
}
|
||||||
LaunchedEffect(reload.value) {
|
LaunchedEffect(reload.value) {
|
||||||
|
|
@ -98,7 +98,7 @@ class UserViews {
|
||||||
.padding(4.dp),
|
.padding(4.dp),
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
) {
|
) {
|
||||||
if (viewModel.userViewModel.openedUser.id?.isNotEmpty() == true) {
|
if (viewModel.userViewModel.openedUser.id.isNotEmpty()) {
|
||||||
val openUser = viewModel.userViewModel.openedUser
|
val openUser = viewModel.userViewModel.openedUser
|
||||||
Image(
|
Image(
|
||||||
bitmap = BitmapFactory.decodeByteArray(
|
bitmap = BitmapFactory.decodeByteArray(
|
||||||
|
|
@ -143,7 +143,7 @@ class UserViews {
|
||||||
.height(104.dp)
|
.height(104.dp)
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
) {
|
) {
|
||||||
if (viewModel.userViewModel.userList.isNotEmpty() == true) {
|
if (viewModel.userViewModel.userList.isNotEmpty()) {
|
||||||
items(viewModel.userViewModel.userList) { user ->
|
items(viewModel.userViewModel.userList) { user ->
|
||||||
Box(
|
Box(
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,10 @@ import androidx.compose.ui.unit.dp
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ActionButton(
|
fun ActionButton(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
text: String,
|
text: String,
|
||||||
icon: ImageVector? = null,
|
icon: ImageVector? = null,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
isFullWidth: Boolean = false,
|
isFullWidth: Boolean = false,
|
||||||
) {
|
) {
|
||||||
val buttonModifier = if (isFullWidth) {
|
val buttonModifier = if (isFullWidth) {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.width
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.KeyboardArrowDown
|
import androidx.compose.material.icons.filled.KeyboardArrowDown
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
|
|
@ -28,8 +27,7 @@ fun <T> DropdownSelector(
|
||||||
selectedValue: T,
|
selectedValue: T,
|
||||||
options: List<T>,
|
options: List<T>,
|
||||||
getDisplayText: (T) -> String,
|
getDisplayText: (T) -> String,
|
||||||
onOptionSelected: (T) -> Unit,
|
onOptionSelected: (T) -> Unit
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
val expanded = remember { mutableStateOf(false) }
|
val expanded = remember { mutableStateOf(false) }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ import android.annotation.SuppressLint
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
import androidx.compose.animation.core.MutableTransitionState
|
import androidx.compose.animation.core.MutableTransitionState
|
||||||
import androidx.compose.animation.core.animateFloat
|
import androidx.compose.animation.core.animateFloat
|
||||||
|
import androidx.compose.animation.core.rememberTransition
|
||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
import androidx.compose.animation.core.updateTransition
|
|
||||||
import androidx.compose.animation.expandVertically
|
import androidx.compose.animation.expandVertically
|
||||||
import androidx.compose.animation.fadeIn
|
import androidx.compose.animation.fadeIn
|
||||||
import androidx.compose.animation.fadeOut
|
import androidx.compose.animation.fadeOut
|
||||||
|
|
@ -50,7 +50,7 @@ fun ExpandableView(
|
||||||
targetState = !mutableExpanded.value
|
targetState = !mutableExpanded.value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val transition = updateTransition(transitionState, label = "transition")
|
val transition = rememberTransition(transitionState, label = "transition")
|
||||||
val arrowRotationDegree = transition.animateFloat(
|
val arrowRotationDegree = transition.animateFloat(
|
||||||
transitionSpec = {
|
transitionSpec = {
|
||||||
tween(durationMillis = EXPANSTION_TRANSITION_DURATION)
|
tween(durationMillis = EXPANSTION_TRANSITION_DURATION)
|
||||||
|
|
@ -90,14 +90,16 @@ fun ExpandableView(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.Start
|
horizontalArrangement = Arrangement.Start
|
||||||
) {
|
) {
|
||||||
if (icon != null) {
|
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = icon,
|
imageVector = icon,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
modifier = Modifier.size(16.dp)
|
modifier = Modifier.size(16.dp)
|
||||||
)
|
)
|
||||||
androidx.compose.foundation.layout.Spacer(modifier = Modifier.padding(end = 8.dp))
|
androidx.compose.foundation.layout.Spacer(
|
||||||
}
|
modifier = Modifier.padding(
|
||||||
|
end = 8.dp
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = title,
|
text = title,
|
||||||
|
|
@ -129,12 +131,14 @@ fun ExpandableView(
|
||||||
animationSpec = tween(EXPANSTION_TRANSITION_DURATION)
|
animationSpec = tween(EXPANSTION_TRANSITION_DURATION)
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.padding(
|
Column(
|
||||||
|
modifier = Modifier.padding(
|
||||||
start = 8.dp,
|
start = 8.dp,
|
||||||
end = 8.dp,
|
end = 8.dp,
|
||||||
top = 0.dp,
|
top = 0.dp,
|
||||||
bottom = 8.dp
|
bottom = 8.dp
|
||||||
)) {
|
)
|
||||||
|
) {
|
||||||
content()
|
content()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,17 @@
|
||||||
package org.kenjinx.android.widgets
|
package org.kenjinx.android.widgets
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
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.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.material3.Switch
|
import androidx.compose.material3.Switch
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.MutableState
|
import androidx.compose.runtime.MutableState
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A reusable switch component with consistent styling across the app.
|
* A reusable switch component with consistent styling across the app.
|
||||||
|
|
@ -32,8 +27,7 @@ import androidx.compose.ui.unit.sp
|
||||||
fun SwitchSelector(
|
fun SwitchSelector(
|
||||||
label: String,
|
label: String,
|
||||||
checked: Boolean,
|
checked: Boolean,
|
||||||
onCheckedChange: (Boolean) -> Unit,
|
onCheckedChange: (Boolean) -> Unit
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|
@ -56,13 +50,11 @@ fun SwitchSelector(
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun MutableState<Boolean>.SwitchSelector(
|
fun MutableState<Boolean>.SwitchSelector(
|
||||||
label: String,
|
label: String
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
SwitchSelector(
|
SwitchSelector(
|
||||||
label = label,
|
label = label,
|
||||||
checked = this.value,
|
checked = this.value,
|
||||||
onCheckedChange = { this.value = it },
|
onCheckedChange = { this.value = it }
|
||||||
modifier = modifier
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue