mirror of
https://git.ryujinx.app/kenji-nx/ryujinx.git
synced 2025-12-14 07:37:04 +00:00
Remove, replace redundant/deprecated code
This commit is contained in:
parent
4d1620c330
commit
f47be3342f
14 changed files with 58 additions and 219 deletions
|
|
@ -42,14 +42,15 @@ class GameController(var activity: Activity) {
|
||||||
companion object {
|
companion object {
|
||||||
private fun init(context: Context, controller: GameController): View {
|
private fun init(context: Context, controller: GameController): View {
|
||||||
val inflater = LayoutInflater.from(context)
|
val inflater = LayoutInflater.from(context)
|
||||||
val view = inflater.inflate(R.layout.game_layout, null)
|
val parent = FrameLayout(context)
|
||||||
|
val view = inflater.inflate(R.layout.game_layout, parent, false)
|
||||||
view.findViewById<FrameLayout>(R.id.leftcontainer)!!.addView(controller.leftGamePad)
|
view.findViewById<FrameLayout>(R.id.leftcontainer)!!.addView(controller.leftGamePad)
|
||||||
view.findViewById<FrameLayout>(R.id.rightcontainer)!!.addView(controller.rightGamePad)
|
view.findViewById<FrameLayout>(R.id.rightcontainer)!!.addView(controller.rightGamePad)
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun Compose(viewModel: MainViewModel): Unit {
|
fun Compose(viewModel: MainViewModel) {
|
||||||
AndroidView(
|
AndroidView(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
factory = { context ->
|
factory = { context ->
|
||||||
|
|
|
||||||
|
|
@ -1,170 +0,0 @@
|
||||||
package org.kenjinx.android
|
|
||||||
|
|
||||||
import android.content.ContentUris
|
|
||||||
import android.content.Context
|
|
||||||
import android.database.Cursor
|
|
||||||
import android.net.Uri
|
|
||||||
import android.os.Environment
|
|
||||||
import android.provider.DocumentsContract
|
|
||||||
import android.provider.MediaStore
|
|
||||||
import androidx.compose.runtime.MutableState
|
|
||||||
import androidx.core.net.toUri
|
|
||||||
import androidx.documentfile.provider.DocumentFile
|
|
||||||
import com.anggrayudi.storage.SimpleStorageHelper
|
|
||||||
import com.anggrayudi.storage.callback.FileCallback
|
|
||||||
import com.anggrayudi.storage.file.copyFileTo
|
|
||||||
import kotlinx.coroutines.CoroutineScope
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import java.io.File
|
|
||||||
import androidx.core.net.toUri
|
|
||||||
|
|
||||||
class Helpers {
|
|
||||||
companion object {
|
|
||||||
fun getPath(context: Context, uri: Uri): String? {
|
|
||||||
|
|
||||||
// DocumentProvider
|
|
||||||
if (DocumentsContract.isDocumentUri(context, uri)) {
|
|
||||||
// ExternalStorageProvider
|
|
||||||
if (isExternalStorageDocument(uri)) {
|
|
||||||
val docId = DocumentsContract.getDocumentId(uri)
|
|
||||||
val split = docId.split(":".toRegex()).toTypedArray()
|
|
||||||
val type = split[0]
|
|
||||||
if ("primary".equals(type, ignoreCase = true)) {
|
|
||||||
return Environment.getExternalStorageDirectory().toString() + "/" + split[1]
|
|
||||||
}
|
|
||||||
} else if (isDownloadsDocument(uri)) {
|
|
||||||
val id = DocumentsContract.getDocumentId(uri)
|
|
||||||
val contentUri = ContentUris.withAppendedId(
|
|
||||||
"content://downloads/public_downloads".toUri(),
|
|
||||||
java.lang.Long.valueOf(id)
|
|
||||||
)
|
|
||||||
return getDataColumn(context, contentUri, null, null)
|
|
||||||
} else if (isMediaDocument(uri)) {
|
|
||||||
val docId = DocumentsContract.getDocumentId(uri)
|
|
||||||
val split = docId.split(":".toRegex()).toTypedArray()
|
|
||||||
val type = split[0]
|
|
||||||
var contentUri: Uri? = null
|
|
||||||
when (type) {
|
|
||||||
"image" -> {
|
|
||||||
contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI
|
|
||||||
}
|
|
||||||
|
|
||||||
"video" -> {
|
|
||||||
contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI
|
|
||||||
}
|
|
||||||
|
|
||||||
"audio" -> {
|
|
||||||
contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val selection = "_id=?"
|
|
||||||
val selectionArgs = arrayOf(split[1])
|
|
||||||
return getDataColumn(context, contentUri, selection, selectionArgs)
|
|
||||||
}
|
|
||||||
} else if ("content".equals(uri.scheme, ignoreCase = true)) {
|
|
||||||
return getDataColumn(context, uri, null, null)
|
|
||||||
} else if ("file".equals(uri.scheme, ignoreCase = true)) {
|
|
||||||
return uri.path
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
fun copyToData(
|
|
||||||
file: DocumentFile, path: String, storageHelper: SimpleStorageHelper,
|
|
||||||
isCopying: MutableState<Boolean>,
|
|
||||||
copyProgress: MutableState<Float>,
|
|
||||||
currentProgressName: MutableState<String>,
|
|
||||||
finish: () -> Unit
|
|
||||||
) {
|
|
||||||
var fPath = path + "/${file.name}"
|
|
||||||
var callback: FileCallback? = object : FileCallback() {
|
|
||||||
override fun onFailed(errorCode: ErrorCode) {
|
|
||||||
super.onFailed(errorCode)
|
|
||||||
File(fPath).delete()
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStart(file: Any, workerThread: Thread): Long {
|
|
||||||
copyProgress.value = 0f
|
|
||||||
|
|
||||||
(file as DocumentFile).apply {
|
|
||||||
currentProgressName.value = "Copying ${file.name}"
|
|
||||||
}
|
|
||||||
return super.onStart(file, workerThread)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onReport(report: Report) {
|
|
||||||
super.onReport(report)
|
|
||||||
|
|
||||||
if (!isCopying.value) {
|
|
||||||
Thread.currentThread().interrupt()
|
|
||||||
}
|
|
||||||
|
|
||||||
copyProgress.value = report.progress / 100f
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCompleted(result: Any) {
|
|
||||||
super.onCompleted(result)
|
|
||||||
isCopying.value = false
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val ioScope = CoroutineScope(Dispatchers.IO)
|
|
||||||
isCopying.value = true
|
|
||||||
File(fPath).delete()
|
|
||||||
file.apply {
|
|
||||||
val f = this
|
|
||||||
ioScope.launch {
|
|
||||||
f.copyFileTo(
|
|
||||||
storageHelper.storage.context,
|
|
||||||
File(path),
|
|
||||||
callback = callback!!
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getDataColumn(
|
|
||||||
context: Context,
|
|
||||||
uri: Uri?,
|
|
||||||
selection: String?,
|
|
||||||
selectionArgs: Array<String>?
|
|
||||||
): String? {
|
|
||||||
var cursor: Cursor? = null
|
|
||||||
val column = "_data"
|
|
||||||
val projection = arrayOf(column)
|
|
||||||
try {
|
|
||||||
cursor = uri?.let {
|
|
||||||
context.contentResolver.query(
|
|
||||||
it,
|
|
||||||
projection,
|
|
||||||
selection,
|
|
||||||
selectionArgs,
|
|
||||||
null
|
|
||||||
)
|
|
||||||
}
|
|
||||||
if (cursor != null && cursor.moveToFirst()) {
|
|
||||||
val column_index: Int = cursor.getColumnIndexOrThrow(column)
|
|
||||||
return cursor.getString(column_index)
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
cursor?.close()
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun isExternalStorageDocument(uri: Uri): Boolean {
|
|
||||||
return "com.android.externalstorage.documents" == uri.authority
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun isDownloadsDocument(uri: Uri): Boolean {
|
|
||||||
return "com.android.providers.downloads.documents" == uri.authority
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun isMediaDocument(uri: Uri): Boolean {
|
|
||||||
return "com.android.providers.media.documents" == uri.authority
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -28,7 +28,6 @@ import org.kenjinx.android.viewmodels.MainViewModel
|
||||||
import org.kenjinx.android.viewmodels.QuickSettings
|
import org.kenjinx.android.viewmodels.QuickSettings
|
||||||
import org.kenjinx.android.viewmodels.GameModel
|
import org.kenjinx.android.viewmodels.GameModel
|
||||||
import org.kenjinx.android.views.MainView
|
import org.kenjinx.android.views.MainView
|
||||||
import android.content.Context
|
|
||||||
import android.content.pm.ActivityInfo
|
import android.content.pm.ActivityInfo
|
||||||
import android.hardware.display.DisplayManager
|
import android.hardware.display.DisplayManager
|
||||||
import android.view.Surface
|
import android.view.Surface
|
||||||
|
|
@ -231,7 +230,7 @@ class MainActivity : BaseActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
uiHandler = UiHandler()
|
uiHandler = UiHandler()
|
||||||
displayManager = getSystemService(Context.DISPLAY_SERVICE) as DisplayManager
|
displayManager = getSystemService(DISPLAY_SERVICE) as DisplayManager
|
||||||
|
|
||||||
mainViewModel = MainViewModel(this)
|
mainViewModel = MainViewModel(this)
|
||||||
mainViewModel!!.physicalControllerManager = physicalControllerManager
|
mainViewModel!!.physicalControllerManager = physicalControllerManager
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class MotionSensorManager(val activity: MainActivity) : SensorEventListener2 {
|
||||||
accelerometer = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER)
|
accelerometer = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER)
|
||||||
gyro = sensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE)
|
gyro = sensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE)
|
||||||
setOrientation90()
|
setOrientation90()
|
||||||
var orientationListener = object : OrientationEventListener(activity) {
|
object : OrientationEventListener(activity) {
|
||||||
override fun onOrientationChanged(orientation: Int) {
|
override fun onOrientationChanged(orientation: Int) {
|
||||||
when {
|
when {
|
||||||
isWithinOrientationRange(orientation, 270) -> {
|
isWithinOrientationRange(orientation, 270) -> {
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,7 @@ class DocumentProvider : DocumentsProvider() {
|
||||||
)
|
)
|
||||||
removeDocument(sourceDocumentId, sourceParentDocumentId)
|
removeDocument(sourceDocumentId, sourceParentDocumentId)
|
||||||
return newDocumentId
|
return newDocumentId
|
||||||
} catch (e: FileNotFoundException) {
|
} catch (_: FileNotFoundException) {
|
||||||
throw FileNotFoundException("Couldn't move document '$sourceDocumentId'")
|
throw FileNotFoundException("Couldn't move document '$sourceDocumentId'")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,11 +45,12 @@ private val LightColorScheme = lightColorScheme(
|
||||||
onSurface = Gray10,
|
onSurface = Gray10,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
@Composable
|
@Composable
|
||||||
fun KenjinxAndroidTheme(
|
fun KenjinxAndroidTheme(
|
||||||
darkTheme: Boolean = isSystemInDarkTheme(),
|
darkTheme: Boolean = isSystemInDarkTheme(),
|
||||||
// Dynamic color is available on Android 12+
|
// Dynamic color is available on Android 12+
|
||||||
dynamicColor: Boolean = false, // Cambiato da true a false per usare i nostri colori personalizzati
|
dynamicColor: Boolean = false, // Changed from true to false to use our custom colors
|
||||||
content: @Composable () -> Unit
|
content: @Composable () -> Unit
|
||||||
) {
|
) {
|
||||||
val colorScheme = when {
|
val colorScheme = when {
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ class GameModel(var file: DocumentFile, val context: Context) {
|
||||||
context.contentResolver.openFileDescriptor(file.uri, "rw")
|
context.contentResolver.openFileDescriptor(file.uri, "rw")
|
||||||
|
|
||||||
return updateDescriptor?.fd ?: -1
|
return updateDescriptor?.fd ?: -1
|
||||||
} catch (e: Exception) {
|
} catch (_: Exception) {
|
||||||
return -2
|
return -2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,9 @@ class MainViewModel(val activity: MainActivity) {
|
||||||
var controller: GameController? = null
|
var controller: GameController? = null
|
||||||
var performanceManager: PerformanceManager? = null
|
var performanceManager: PerformanceManager? = null
|
||||||
var selected: GameModel? = null
|
var selected: GameModel? = null
|
||||||
val loadGameModel: MutableState<GameModel?> = mutableStateOf<GameModel?>(null)
|
val loadGameModel: MutableState<GameModel?> = mutableStateOf(null)
|
||||||
val bootPath: MutableState<String?> = mutableStateOf<String?>(null)
|
val bootPath: MutableState<String?> = mutableStateOf(null)
|
||||||
val forceNceAndPptc: MutableState<Boolean> = mutableStateOf<Boolean>(false)
|
val forceNceAndPptc: MutableState<Boolean> = mutableStateOf(false)
|
||||||
var isMiiEditorLaunched = false
|
var isMiiEditorLaunched = false
|
||||||
val userViewModel = UserViewModel()
|
val userViewModel = UserViewModel()
|
||||||
val logging = Logging(this)
|
val logging = Logging(this)
|
||||||
|
|
@ -114,7 +114,7 @@ class MainViewModel(val activity: MainActivity) {
|
||||||
|
|
||||||
if(overrideSettings == true)
|
if(overrideSettings == true)
|
||||||
{
|
{
|
||||||
settings.overrideSettings(forceNceAndPptc);
|
settings.overrideSettings(forceNceAndPptc)
|
||||||
}
|
}
|
||||||
|
|
||||||
var success = KenjinxNative.graphicsInitialize(
|
var success = KenjinxNative.graphicsInitialize(
|
||||||
|
|
|
||||||
|
|
@ -329,6 +329,7 @@ class SettingsViewModel(val activity: MainActivity) {
|
||||||
} finally {
|
} finally {
|
||||||
MainActivity.mainViewModel?.refreshFirmwareVersion()
|
MainActivity.mainViewModel?.refreshFirmwareVersion()
|
||||||
installState.value = FirmwareInstallState.Done
|
installState.value = FirmwareInstallState.Done
|
||||||
|
descriptor.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -401,7 +402,7 @@ class SettingsViewModel(val activity: MainActivity) {
|
||||||
if (!header.isDirectory) {
|
if (!header.isDirectory) {
|
||||||
val bos = BufferedOutputStream(FileOutputStream(filePath))
|
val bos = BufferedOutputStream(FileOutputStream(filePath))
|
||||||
val bytesIn = ByteArray(4096)
|
val bytesIn = ByteArray(4096)
|
||||||
var read: Int = 0
|
var read = 0
|
||||||
while (zip.read(bytesIn).also { read = it } > 0) {
|
while (zip.read(bytesIn).also { read = it } > 0) {
|
||||||
bos.write(bytesIn, 0, read)
|
bos.write(bytesIn, 0, read)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class TitleUpdateViewModel(val titleId: String) {
|
||||||
uri,
|
uri,
|
||||||
Intent.FLAG_GRANT_READ_URI_PERMISSION
|
Intent.FLAG_GRANT_READ_URI_PERMISSION
|
||||||
)
|
)
|
||||||
} catch (securityException: SecurityException) {
|
} catch (_: SecurityException) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ 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
|
||||||
import androidx.compose.runtime.mutableDoubleStateOf
|
import androidx.compose.runtime.mutableDoubleStateOf
|
||||||
|
import androidx.compose.runtime.mutableFloatStateOf
|
||||||
import androidx.compose.runtime.mutableIntStateOf
|
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
|
||||||
|
|
@ -33,7 +34,7 @@ import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.compose.ui.viewinterop.AndroidView
|
import androidx.compose.ui.viewinterop.AndroidView
|
||||||
import androidx.compose.ui.window.Popup
|
import androidx.compose.ui.window.Popup
|
||||||
import androidx.compose.ui.draw.alpha // ← NEU
|
import androidx.compose.ui.draw.alpha
|
||||||
import compose.icons.CssGgIcons
|
import compose.icons.CssGgIcons
|
||||||
import compose.icons.cssggicons.ToolbarBottom
|
import compose.icons.cssggicons.ToolbarBottom
|
||||||
import org.kenjinx.android.GameController
|
import org.kenjinx.android.GameController
|
||||||
|
|
@ -45,6 +46,7 @@ import org.kenjinx.android.viewmodels.MainViewModel
|
||||||
import org.kenjinx.android.viewmodels.QuickSettings
|
import org.kenjinx.android.viewmodels.QuickSettings
|
||||||
import org.kenjinx.android.viewmodels.VSyncMode
|
import org.kenjinx.android.viewmodels.VSyncMode
|
||||||
import org.kenjinx.android.widgets.SimpleAlertDialog
|
import org.kenjinx.android.widgets.SimpleAlertDialog
|
||||||
|
import java.util.Locale
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
class GameViews {
|
class GameViews {
|
||||||
|
|
@ -82,7 +84,7 @@ class GameViews {
|
||||||
val enableMotion = remember { mutableStateOf(QuickSettings(mainViewModel.activity).enableMotion) }
|
val enableMotion = remember { mutableStateOf(QuickSettings(mainViewModel.activity).enableMotion) }
|
||||||
val showMore = remember { mutableStateOf(false) }
|
val showMore = remember { mutableStateOf(false) }
|
||||||
val showLoading = remember { mutableStateOf(true) }
|
val showLoading = remember { mutableStateOf(true) }
|
||||||
val progressValue = remember { mutableStateOf(0.0f) }
|
val progressValue = remember { mutableFloatStateOf(0.0f) }
|
||||||
val progress = remember { mutableStateOf("Loading") }
|
val progress = remember { mutableStateOf("Loading") }
|
||||||
|
|
||||||
// --- Read overlay settings
|
// --- Read overlay settings
|
||||||
|
|
@ -90,7 +92,7 @@ class GameViews {
|
||||||
mutableStateOf(QuickSettings(mainViewModel.activity).overlayMenuPosition)
|
mutableStateOf(QuickSettings(mainViewModel.activity).overlayMenuPosition)
|
||||||
}
|
}
|
||||||
val overlayOpacityState = remember {
|
val overlayOpacityState = remember {
|
||||||
mutableStateOf(QuickSettings(mainViewModel.activity).overlayMenuOpacity.coerceIn(0f, 1f))
|
mutableFloatStateOf(QuickSettings(mainViewModel.activity).overlayMenuOpacity.coerceIn(0f, 1f))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auxiliary mapping position → alignment
|
// Auxiliary mapping position → alignment
|
||||||
|
|
@ -160,7 +162,7 @@ class GameViews {
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.align(overlayAlignment())
|
.align(overlayAlignment())
|
||||||
.padding(8.dp)
|
.padding(8.dp)
|
||||||
.alpha(overlayOpacityState.value) // 0f = unsichtbar, aber weiter klickbar
|
.alpha(overlayOpacityState.floatValue) // 0f = invisible, but still clickable
|
||||||
) {
|
) {
|
||||||
IconButton(modifier = Modifier.padding(4.dp), onClick = {
|
IconButton(modifier = Modifier.padding(4.dp), onClick = {
|
||||||
showMore.value = true
|
showMore.value = true
|
||||||
|
|
@ -174,7 +176,7 @@ class GameViews {
|
||||||
|
|
||||||
if (showMore.value) {
|
if (showMore.value) {
|
||||||
Popup(
|
Popup(
|
||||||
alignment = overlayAlignment(), // --- NEU: Panel an gleicher Position
|
alignment = overlayAlignment(), // --- Panel in the same position
|
||||||
onDismissRequest = { showMore.value = false }
|
onDismissRequest = { showMore.value = false }
|
||||||
) {
|
) {
|
||||||
Surface(
|
Surface(
|
||||||
|
|
@ -264,7 +266,7 @@ class GameViews {
|
||||||
SimpleAlertDialog.Progress(
|
SimpleAlertDialog.Progress(
|
||||||
showDialog = showLoading,
|
showDialog = showLoading,
|
||||||
progressText = progress.value,
|
progressText = progress.value,
|
||||||
progressValue = progressValue.value
|
progressValue = progressValue.floatValue
|
||||||
)
|
)
|
||||||
|
|
||||||
SimpleAlertDialog.Confirmation(
|
SimpleAlertDialog.Confirmation(
|
||||||
|
|
@ -302,9 +304,9 @@ class GameViews {
|
||||||
var gameTimeVal = 0.0
|
var gameTimeVal = 0.0
|
||||||
if (!gameTime.doubleValue.isInfinite())
|
if (!gameTime.doubleValue.isInfinite())
|
||||||
gameTimeVal = gameTime.doubleValue
|
gameTimeVal = gameTime.doubleValue
|
||||||
Text(text = "${String.format("%.3f", fifo.doubleValue)} %")
|
Text(text = "${String.format(Locale.getDefault(), "%.3f", fifo.doubleValue)} %")
|
||||||
Text(text = "${String.format("%.3f", gameFps.doubleValue)} FPS")
|
Text(text = "${String.format(Locale.getDefault(), "%.3f", gameFps.doubleValue)} FPS")
|
||||||
Text(text = "${String.format("%.3f", gameTimeVal)} ms")
|
Text(text = "${String.format(Locale.getDefault(), "%.3f", gameTimeVal)} ms")
|
||||||
Box(modifier = Modifier.width(96.dp)) {
|
Box(modifier = Modifier.width(96.dp)) {
|
||||||
Column {
|
Column {
|
||||||
LazyColumn {
|
LazyColumn {
|
||||||
|
|
|
||||||
|
|
@ -44,10 +44,10 @@ import androidx.compose.material3.IconButton
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.ModalBottomSheet
|
import androidx.compose.material3.ModalBottomSheet
|
||||||
import androidx.compose.material3.OutlinedTextField
|
import androidx.compose.material3.OutlinedTextField
|
||||||
|
import androidx.compose.material3.OutlinedTextFieldDefaults
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextFieldDefaults
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.MutableState
|
import androidx.compose.runtime.MutableState
|
||||||
|
|
@ -255,10 +255,14 @@ class HomeViews {
|
||||||
leadingIcon = { Icon(Icons.Filled.Search, contentDescription = "Search") },
|
leadingIcon = { Icon(Icons.Filled.Search, contentDescription = "Search") },
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
shape = RoundedCornerShape(8.dp),
|
shape = RoundedCornerShape(8.dp),
|
||||||
colors = TextFieldDefaults.outlinedTextFieldColors(
|
colors = OutlinedTextFieldDefaults.colors(
|
||||||
focusedBorderColor = MaterialTheme.colorScheme.primary,
|
focusedContainerColor = Color.Transparent,
|
||||||
unfocusedBorderColor = MaterialTheme.colorScheme.outline
|
unfocusedContainerColor = Color.Transparent,
|
||||||
)
|
disabledContainerColor = Color.Transparent,
|
||||||
|
errorContainerColor = Color.Transparent,
|
||||||
|
focusedBorderColor = MaterialTheme.colorScheme.primary,
|
||||||
|
unfocusedBorderColor = MaterialTheme.colorScheme.outline,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -332,7 +336,7 @@ class HomeViews {
|
||||||
if (this.isNotEmpty() && (query.value.trim()
|
if (this.isNotEmpty() && (query.value.trim()
|
||||||
.isEmpty() || this.lowercase(Locale.getDefault())
|
.isEmpty() || this.lowercase(Locale.getDefault())
|
||||||
.contains(query.value))) {
|
.contains(query.value))) {
|
||||||
Box(modifier = Modifier.animateItemPlacement()) {
|
Box(modifier = Modifier.animateItem()) {
|
||||||
ListGameItem(
|
ListGameItem(
|
||||||
it,
|
it,
|
||||||
viewModel,
|
viewModel,
|
||||||
|
|
@ -386,7 +390,7 @@ class HomeViews {
|
||||||
viewModel.mainViewModel.loadGameModel.value!!,
|
viewModel.mainViewModel.loadGameModel.value!!,
|
||||||
true,
|
true,
|
||||||
viewModel.mainViewModel.forceNceAndPptc.value
|
viewModel.mainViewModel.forceNceAndPptc.value
|
||||||
) ?: false
|
)
|
||||||
if (success == 1) {
|
if (success == 1) {
|
||||||
launchOnUiThread {
|
launchOnUiThread {
|
||||||
viewModel.mainViewModel.navigateToGame()
|
viewModel.mainViewModel.navigateToGame()
|
||||||
|
|
@ -588,7 +592,7 @@ class HomeViews {
|
||||||
}
|
}
|
||||||
Column {
|
Column {
|
||||||
Text(text = gameModel.version ?: "")
|
Text(text = gameModel.version ?: "")
|
||||||
Text(text = String.format("%.3f", gameModel.fileSize))
|
Text(text = String.format(Locale.getDefault(), "%.3f", gameModel.fileSize))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -106,8 +106,8 @@ class SettingViews {
|
||||||
val enablePptc = remember { mutableStateOf(false) }
|
val enablePptc = remember { mutableStateOf(false) }
|
||||||
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) }
|
val enableFsIntegrityChecks = remember { mutableStateOf(false) }
|
||||||
var fsGlobalAccessLogMode = remember { mutableIntStateOf(0) }
|
val 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) }
|
||||||
|
|
@ -125,7 +125,7 @@ class SettingViews {
|
||||||
val showDataImportDialog = remember { mutableStateOf(false) }
|
val showDataImportDialog = remember { mutableStateOf(false) }
|
||||||
val dataResetState = remember { mutableStateOf(DataResetState.Query) }
|
val dataResetState = remember { mutableStateOf(DataResetState.Query) }
|
||||||
val dataImportState = remember { mutableStateOf(DataImportState.File) }
|
val dataImportState = remember { mutableStateOf(DataImportState.File) }
|
||||||
var dataFile = remember { mutableStateOf<DocumentFile?>(null) }
|
val dataFile = remember { mutableStateOf<DocumentFile?>(null) }
|
||||||
val isGrid = remember { mutableStateOf(true) }
|
val isGrid = remember { mutableStateOf(true) }
|
||||||
val useSwitchLayout = remember { mutableStateOf(true) }
|
val useSwitchLayout = remember { mutableStateOf(true) }
|
||||||
val enableMotion = remember { mutableStateOf(true) }
|
val enableMotion = remember { mutableStateOf(true) }
|
||||||
|
|
@ -1336,7 +1336,7 @@ class SettingViews {
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
var isDriverSelectorOpen = remember { mutableStateOf(false) }
|
val isDriverSelectorOpen = remember { mutableStateOf(false) }
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ 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.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
|
||||||
|
|
@ -42,11 +43,11 @@ class VulkanDriverViews {
|
||||||
companion object {
|
companion object {
|
||||||
@Composable
|
@Composable
|
||||||
fun Main(activity: MainActivity, openDialog: MutableState<Boolean>) {
|
fun Main(activity: MainActivity, openDialog: MutableState<Boolean>) {
|
||||||
var driverViewModel = VulkanDriverViewModel(activity)
|
val driverViewModel = VulkanDriverViewModel(activity)
|
||||||
var isChanged = remember { mutableStateOf(false) }
|
val isChanged = remember { mutableStateOf(false) }
|
||||||
var refresh = remember { mutableStateOf(false) }
|
val refresh = remember { mutableStateOf(false) }
|
||||||
var drivers = driverViewModel.getAvailableDrivers()
|
val drivers = driverViewModel.getAvailableDrivers()
|
||||||
var selectedDriver = remember { mutableStateOf(0) }
|
val selectedDriver = remember { mutableIntStateOf(0) }
|
||||||
|
|
||||||
if (refresh.value) {
|
if (refresh.value) {
|
||||||
isChanged.value = true
|
isChanged.value = true
|
||||||
|
|
@ -54,7 +55,7 @@ class VulkanDriverViews {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isChanged.value) {
|
if (!isChanged.value) {
|
||||||
selectedDriver.value =
|
selectedDriver.intValue =
|
||||||
drivers.indexOfFirst { it.driverPath == driverViewModel.selected } + 1
|
drivers.indexOfFirst { it.driverPath == driverViewModel.selected } + 1
|
||||||
isChanged.value = true
|
isChanged.value = true
|
||||||
}
|
}
|
||||||
|
|
@ -75,7 +76,7 @@ class VulkanDriverViews {
|
||||||
onClick = {
|
onClick = {
|
||||||
driverViewModel.add(refresh)
|
driverViewModel.add(refresh)
|
||||||
refresh.value = true
|
refresh.value = true
|
||||||
selectedDriver.value = 0
|
selectedDriver.intValue = 0
|
||||||
driverViewModel.selected = ""
|
driverViewModel.selected = ""
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
|
|
@ -132,16 +133,16 @@ class VulkanDriverViews {
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(vertical = 4.dp)
|
.padding(vertical = 4.dp)
|
||||||
.clickable {
|
.clickable {
|
||||||
selectedDriver.value = 0
|
selectedDriver.intValue = 0
|
||||||
isChanged.value = true
|
isChanged.value = true
|
||||||
driverViewModel.selected = ""
|
driverViewModel.selected = ""
|
||||||
},
|
},
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
RadioButton(
|
RadioButton(
|
||||||
selected = selectedDriver.value == 0 || driverViewModel.selected.isEmpty(),
|
selected = selectedDriver.intValue == 0 || driverViewModel.selected.isEmpty(),
|
||||||
onClick = {
|
onClick = {
|
||||||
selectedDriver.value = 0
|
selectedDriver.intValue = 0
|
||||||
isChanged.value = true
|
isChanged.value = true
|
||||||
driverViewModel.selected = ""
|
driverViewModel.selected = ""
|
||||||
}
|
}
|
||||||
|
|
@ -155,7 +156,7 @@ class VulkanDriverViews {
|
||||||
}
|
}
|
||||||
var driverIndex = 1
|
var driverIndex = 1
|
||||||
for (driver in drivers) {
|
for (driver in drivers) {
|
||||||
var ind = driverIndex
|
val ind = driverIndex
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
|
@ -163,16 +164,16 @@ class VulkanDriverViews {
|
||||||
vertical = 4.dp
|
vertical = 4.dp
|
||||||
)
|
)
|
||||||
.clickable {
|
.clickable {
|
||||||
selectedDriver.value = ind
|
selectedDriver.intValue = ind
|
||||||
isChanged.value = true
|
isChanged.value = true
|
||||||
driverViewModel.selected = driver.driverPath
|
driverViewModel.selected = driver.driverPath
|
||||||
},
|
},
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
RadioButton(
|
RadioButton(
|
||||||
selected = selectedDriver.value == ind,
|
selected = selectedDriver.intValue == ind,
|
||||||
onClick = {
|
onClick = {
|
||||||
selectedDriver.value = ind
|
selectedDriver.intValue = ind
|
||||||
isChanged.value = true
|
isChanged.value = true
|
||||||
driverViewModel.selected = driver.driverPath
|
driverViewModel.selected = driver.driverPath
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue