mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-11-29 00:50:10 +01:00
Some changes to UI
This commit is contained in:
parent
ed7c256728
commit
1112f12af7
11 changed files with 282 additions and 153 deletions
|
|
@ -33,7 +33,6 @@ import org.yuzu.yuzu_emu.features.input.NativeInput
|
||||||
import org.yuzu.yuzu_emu.features.settings.model.Settings
|
import org.yuzu.yuzu_emu.features.settings.model.Settings
|
||||||
import org.yuzu.yuzu_emu.features.settings.model.view.PathSetting
|
import org.yuzu.yuzu_emu.features.settings.model.view.PathSetting
|
||||||
import org.yuzu.yuzu_emu.fragments.MessageDialogFragment
|
import org.yuzu.yuzu_emu.fragments.MessageDialogFragment
|
||||||
import org.yuzu.yuzu_emu.fragments.ProgressDialogFragment
|
|
||||||
import org.yuzu.yuzu_emu.utils.PathUtil
|
import org.yuzu.yuzu_emu.utils.PathUtil
|
||||||
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
|
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
|
||||||
import org.yuzu.yuzu_emu.utils.*
|
import org.yuzu.yuzu_emu.utils.*
|
||||||
|
|
@ -115,29 +114,6 @@ class SettingsFragment : Fragment() {
|
||||||
viewLifecycleOwner,
|
viewLifecycleOwner,
|
||||||
resetState = { settingsViewModel.setShouldReloadSettingsList(false) }
|
resetState = { settingsViewModel.setShouldReloadSettingsList(false) }
|
||||||
) { if (it) presenter.loadSettingsList() }
|
) { if (it) presenter.loadSettingsList() }
|
||||||
settingsViewModel.shouldShowLosslessInstaller.collect(
|
|
||||||
viewLifecycleOwner,
|
|
||||||
resetState = { settingsViewModel.setShouldShowLosslessInstaller(false) }
|
|
||||||
) { if (it) losslessDllPickerLauncher.launch(arrayOf("*/*")) }
|
|
||||||
settingsViewModel.shouldShowLosslessRemoveDialog.collect(
|
|
||||||
viewLifecycleOwner,
|
|
||||||
resetState = { settingsViewModel.setShouldShowLosslessRemoveDialog(false) }
|
|
||||||
) {
|
|
||||||
if (it) {
|
|
||||||
MessageDialogFragment.newInstance(
|
|
||||||
activity = requireActivity(),
|
|
||||||
titleId = R.string.lossless_scaling_remove,
|
|
||||||
descriptionId = R.string.lossless_scaling_remove_confirmation,
|
|
||||||
positiveButtonTitleId = R.string.lossless_scaling_remove,
|
|
||||||
positiveAction = {
|
|
||||||
LosslessScalingHelper.remove()
|
|
||||||
settingsViewModel.setShouldReloadSettingsList(true)
|
|
||||||
},
|
|
||||||
showNegativeButton = true,
|
|
||||||
negativeAction = {}
|
|
||||||
).show(parentFragmentManager, MessageDialogFragment.TAG)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
settingsViewModel.adapterItemChanged.collect(
|
settingsViewModel.adapterItemChanged.collect(
|
||||||
viewLifecycleOwner,
|
viewLifecycleOwner,
|
||||||
resetState = { settingsViewModel.setAdapterItemChanged(-1) }
|
resetState = { settingsViewModel.setAdapterItemChanged(-1) }
|
||||||
|
|
@ -291,33 +267,6 @@ private fun getPlayerIndex(): Int =
|
||||||
directoryPickerLauncher.launch(null)
|
directoryPickerLauncher.launch(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val losslessDllPickerLauncher = registerForActivityResult(
|
|
||||||
ActivityResultContracts.OpenDocument()
|
|
||||||
) { uri ->
|
|
||||||
if (uri == null) {
|
|
||||||
return@registerForActivityResult
|
|
||||||
}
|
|
||||||
|
|
||||||
val resultStrings = resources.getStringArray(R.array.losslessDllResults)
|
|
||||||
ProgressDialogFragment.newInstance(
|
|
||||||
requireActivity(),
|
|
||||||
R.string.lossless_scaling_installing,
|
|
||||||
false
|
|
||||||
) { _, _ ->
|
|
||||||
val result = LosslessScalingHelper.install(uri)
|
|
||||||
if (result == LosslessScalingHelper.RESULT_OK) {
|
|
||||||
getString(R.string.lossless_scaling_install_success)
|
|
||||||
} else {
|
|
||||||
MessageDialogFragment.newInstance(
|
|
||||||
titleId = R.string.lossless_scaling_install_failed,
|
|
||||||
descriptionString = resultStrings[result]
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}.apply {
|
|
||||||
onDialogComplete = { settingsViewModel.setShouldReloadSettingsList(true) }
|
|
||||||
}.show(parentFragmentManager, ProgressDialogFragment.TAG)
|
|
||||||
}
|
|
||||||
|
|
||||||
private val directoryPickerLauncher = registerForActivityResult(
|
private val directoryPickerLauncher = registerForActivityResult(
|
||||||
ActivityResultContracts.OpenDocumentTree()
|
ActivityResultContracts.OpenDocumentTree()
|
||||||
) { uri ->
|
) { uri ->
|
||||||
|
|
|
||||||
|
|
@ -79,12 +79,7 @@ class SettingsFragmentPresenter(
|
||||||
|
|
||||||
private fun addFrameGenSettings(sl: ArrayList<SettingsItem>) {
|
private fun addFrameGenSettings(sl: ArrayList<SettingsItem>) {
|
||||||
sl.apply {
|
sl.apply {
|
||||||
val installed = LosslessScalingHelper.isInstalled()
|
if (!LosslessScalingHelper.isSupportedByGpu()) {
|
||||||
val supported = LosslessScalingHelper.isSupportedByGpu()
|
|
||||||
|
|
||||||
add(HeaderSetting(R.string.lossless_scaling))
|
|
||||||
|
|
||||||
if (!supported) {
|
|
||||||
add(
|
add(
|
||||||
RunnableSetting(
|
RunnableSetting(
|
||||||
titleId = R.string.frame_gen_unsupported,
|
titleId = R.string.frame_gen_unsupported,
|
||||||
|
|
@ -92,38 +87,16 @@ class SettingsFragmentPresenter(
|
||||||
isRunnable = false
|
isRunnable = false
|
||||||
) {}
|
) {}
|
||||||
)
|
)
|
||||||
}
|
} else if (!LosslessScalingHelper.isInstalled()) {
|
||||||
|
|
||||||
add(
|
|
||||||
RunnableSetting(
|
|
||||||
titleId = if (installed) {
|
|
||||||
R.string.lossless_scaling_replace
|
|
||||||
} else {
|
|
||||||
R.string.lossless_scaling_install
|
|
||||||
},
|
|
||||||
descriptionId = if (installed) {
|
|
||||||
R.string.lossless_scaling_replace_description
|
|
||||||
} else {
|
|
||||||
R.string.lossless_scaling_install_description
|
|
||||||
},
|
|
||||||
isRunnable = !NativeLibrary.isRunning(),
|
|
||||||
iconId = R.drawable.ic_install
|
|
||||||
) { settingsViewModel.setShouldShowLosslessInstaller(true) }
|
|
||||||
)
|
|
||||||
|
|
||||||
if (installed) {
|
|
||||||
add(
|
add(
|
||||||
RunnableSetting(
|
RunnableSetting(
|
||||||
titleId = R.string.lossless_scaling_remove,
|
titleId = R.string.lossless_scaling_missing,
|
||||||
descriptionId = R.string.lossless_scaling_remove_description,
|
descriptionId = R.string.lossless_scaling_missing_description,
|
||||||
isRunnable = !NativeLibrary.isRunning(),
|
isRunnable = false
|
||||||
iconId = R.drawable.ic_delete
|
) {}
|
||||||
) { settingsViewModel.setShouldShowLosslessRemoveDialog(true) }
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
add(HeaderSetting(R.string.frame_gen))
|
|
||||||
|
|
||||||
add(BooleanSetting.RENDERER_FRAME_GEN.key)
|
add(BooleanSetting.RENDERER_FRAME_GEN.key)
|
||||||
add(IntSetting.RENDERER_FRAME_GEN_TARGET_RATE.key)
|
add(IntSetting.RENDERER_FRAME_GEN_TARGET_RATE.key)
|
||||||
if (IntSetting.RENDERER_FRAME_GEN_TARGET_RATE.getInt(
|
if (IntSetting.RENDERER_FRAME_GEN_TARGET_RATE.getInt(
|
||||||
|
|
@ -234,14 +207,6 @@ class SettingsFragmentPresenter(
|
||||||
menuKey = MenuTag.SECTION_RENDERER
|
menuKey = MenuTag.SECTION_RENDERER
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
add(
|
|
||||||
SubmenuSetting(
|
|
||||||
titleId = R.string.frame_gen,
|
|
||||||
descriptionId = R.string.frame_gen_submenu_description,
|
|
||||||
iconId = R.drawable.ic_duck,
|
|
||||||
menuKey = MenuTag.SECTION_FRAME_GEN
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if (!NativeConfig.isPerGameConfigLoaded()) {
|
if (!NativeConfig.isPerGameConfigLoaded()) {
|
||||||
add(
|
add(
|
||||||
SubmenuSetting(
|
SubmenuSetting(
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ enum class SettingsSubscreen {
|
||||||
DRIVER_MANAGER,
|
DRIVER_MANAGER,
|
||||||
DRIVER_FETCHER,
|
DRIVER_FETCHER,
|
||||||
FREEDRENO_SETTINGS,
|
FREEDRENO_SETTINGS,
|
||||||
|
LOSSLESS_MANAGER,
|
||||||
APPLET_LAUNCHER,
|
APPLET_LAUNCHER,
|
||||||
INSTALLABLE,
|
INSTALLABLE,
|
||||||
GAME_FOLDERS,
|
GAME_FOLDERS,
|
||||||
|
|
@ -126,6 +127,7 @@ class SettingsSubscreenActivity : AppCompatActivity() {
|
||||||
SettingsSubscreen.DRIVER_MANAGER -> R.id.driverManagerFragment
|
SettingsSubscreen.DRIVER_MANAGER -> R.id.driverManagerFragment
|
||||||
SettingsSubscreen.DRIVER_FETCHER -> R.id.driverFetcherFragment
|
SettingsSubscreen.DRIVER_FETCHER -> R.id.driverFetcherFragment
|
||||||
SettingsSubscreen.FREEDRENO_SETTINGS -> R.id.freedrenoSettingsFragment
|
SettingsSubscreen.FREEDRENO_SETTINGS -> R.id.freedrenoSettingsFragment
|
||||||
|
SettingsSubscreen.LOSSLESS_MANAGER -> R.id.losslessManagerFragment
|
||||||
SettingsSubscreen.APPLET_LAUNCHER -> R.id.appletLauncherFragment
|
SettingsSubscreen.APPLET_LAUNCHER -> R.id.appletLauncherFragment
|
||||||
SettingsSubscreen.INSTALLABLE -> R.id.installableFragment
|
SettingsSubscreen.INSTALLABLE -> R.id.installableFragment
|
||||||
SettingsSubscreen.GAME_FOLDERS -> R.id.gameFoldersFragment
|
SettingsSubscreen.GAME_FOLDERS -> R.id.gameFoldersFragment
|
||||||
|
|
|
||||||
|
|
@ -36,12 +36,6 @@ class SettingsViewModel : ViewModel() {
|
||||||
val shouldReloadSettingsList: StateFlow<Boolean> get() = _shouldReloadSettingsList
|
val shouldReloadSettingsList: StateFlow<Boolean> get() = _shouldReloadSettingsList
|
||||||
private val _shouldReloadSettingsList = MutableStateFlow(false)
|
private val _shouldReloadSettingsList = MutableStateFlow(false)
|
||||||
|
|
||||||
val shouldShowLosslessInstaller: StateFlow<Boolean> get() = _shouldShowLosslessInstaller
|
|
||||||
private val _shouldShowLosslessInstaller = MutableStateFlow(false)
|
|
||||||
|
|
||||||
val shouldShowLosslessRemoveDialog: StateFlow<Boolean> get() = _shouldShowLosslessRemoveDialog
|
|
||||||
private val _shouldShowLosslessRemoveDialog = MutableStateFlow(false)
|
|
||||||
|
|
||||||
val sliderProgress: StateFlow<Int> get() = _sliderProgress
|
val sliderProgress: StateFlow<Int> get() = _sliderProgress
|
||||||
private val _sliderProgress = MutableStateFlow(-1)
|
private val _sliderProgress = MutableStateFlow(-1)
|
||||||
|
|
||||||
|
|
@ -91,14 +85,6 @@ class SettingsViewModel : ViewModel() {
|
||||||
_shouldReloadSettingsList.value = value
|
_shouldReloadSettingsList.value = value
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setShouldShowLosslessInstaller(value: Boolean) {
|
|
||||||
_shouldShowLosslessInstaller.value = value
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setShouldShowLosslessRemoveDialog(value: Boolean) {
|
|
||||||
_shouldShowLosslessRemoveDialog.value = value
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setSliderTextValue(value: Float, units: String) {
|
fun setSliderTextValue(value: Float, units: String) {
|
||||||
_sliderProgress.value = value.toInt()
|
_sliderProgress.value = value.toInt()
|
||||||
_sliderTextValue.value = String.format(
|
_sliderTextValue.value = String.format(
|
||||||
|
|
|
||||||
|
|
@ -369,6 +369,21 @@ class GamePropertiesFragment : Fragment() {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
add(
|
||||||
|
SubmenuProperty(
|
||||||
|
R.string.frame_gen,
|
||||||
|
R.string.frame_gen_per_game_description,
|
||||||
|
R.drawable.ic_duck,
|
||||||
|
action = {
|
||||||
|
val action = HomeNavigationDirections.actionGlobalSettingsActivity(
|
||||||
|
args.game,
|
||||||
|
Settings.MenuTag.SECTION_FRAME_GEN
|
||||||
|
)
|
||||||
|
binding.root.findNavController().navigate(action)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if (GpuDriverHelper.isAdrenoGpu()) {
|
if (GpuDriverHelper.isAdrenoGpu()) {
|
||||||
add(
|
add(
|
||||||
SubmenuProperty(
|
SubmenuProperty(
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.app.ActivityCompat
|
import androidx.core.app.ActivityCompat
|
||||||
import androidx.core.app.NotificationCompat
|
import androidx.core.app.NotificationCompat
|
||||||
|
|
@ -176,8 +175,14 @@ class HomeSettingsFragment : Fragment() {
|
||||||
HomeSetting(
|
HomeSetting(
|
||||||
R.string.lossless_scaling,
|
R.string.lossless_scaling,
|
||||||
R.string.lossless_scaling_description,
|
R.string.lossless_scaling_description,
|
||||||
R.drawable.ic_frames,
|
R.drawable.ic_duck,
|
||||||
{ onLosslessScalingClicked() },
|
{
|
||||||
|
val action = HomeNavigationDirections.actionGlobalSettingsSubscreenActivity(
|
||||||
|
SettingsSubscreen.LOSSLESS_MANAGER,
|
||||||
|
null
|
||||||
|
)
|
||||||
|
binding.root.findNavController().navigate(action)
|
||||||
|
},
|
||||||
{ true },
|
{ true },
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
|
@ -354,48 +359,6 @@ class HomeSettingsFragment : Fragment() {
|
||||||
LosslessScalingHelper.refreshStatus()
|
LosslessScalingHelper.refreshStatus()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onLosslessScalingClicked() {
|
|
||||||
if (!LosslessScalingHelper.isInstalled()) {
|
|
||||||
getLosslessDllLauncher.launch(arrayOf("*/*"))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageDialogFragment.newInstance(
|
|
||||||
requireActivity(),
|
|
||||||
titleId = R.string.lossless_scaling,
|
|
||||||
descriptionId = R.string.lossless_scaling_installed_description,
|
|
||||||
positiveButtonTitleId = R.string.lossless_scaling_replace,
|
|
||||||
positiveAction = { getLosslessDllLauncher.launch(arrayOf("*/*")) },
|
|
||||||
showNegativeButton = true,
|
|
||||||
negativeButtonTitleId = R.string.lossless_scaling_remove,
|
|
||||||
negativeAction = { LosslessScalingHelper.remove() }
|
|
||||||
).show(parentFragmentManager, MessageDialogFragment.TAG)
|
|
||||||
}
|
|
||||||
|
|
||||||
private val getLosslessDllLauncher =
|
|
||||||
registerForActivityResult(ActivityResultContracts.OpenDocument()) { result ->
|
|
||||||
if (result == null) {
|
|
||||||
return@registerForActivityResult
|
|
||||||
}
|
|
||||||
|
|
||||||
val resultStrings = resources.getStringArray(R.array.losslessDllResults)
|
|
||||||
ProgressDialogFragment.newInstance(
|
|
||||||
requireActivity(),
|
|
||||||
R.string.lossless_scaling_installing,
|
|
||||||
false
|
|
||||||
) { _, _ ->
|
|
||||||
val installResult = LosslessScalingHelper.install(result)
|
|
||||||
if (installResult == LosslessScalingHelper.RESULT_OK) {
|
|
||||||
getString(R.string.lossless_scaling_install_success)
|
|
||||||
} else {
|
|
||||||
MessageDialogFragment.newInstance(
|
|
||||||
titleId = R.string.lossless_scaling_install_failed,
|
|
||||||
descriptionString = resultStrings[installResult]
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}.show(parentFragmentManager, ProgressDialogFragment.TAG)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
super.onDestroyView()
|
super.onDestroyView()
|
||||||
_binding = null
|
_binding = null
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,174 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
package org.yuzu.yuzu_emu.fragments
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.core.view.ViewCompat
|
||||||
|
import androidx.core.view.WindowInsetsCompat
|
||||||
|
import androidx.core.view.updatePadding
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
|
import com.google.android.material.transition.MaterialSharedAxis
|
||||||
|
import org.yuzu.yuzu_emu.NativeLibrary
|
||||||
|
import org.yuzu.yuzu_emu.R
|
||||||
|
import org.yuzu.yuzu_emu.adapters.HomeSettingAdapter
|
||||||
|
import org.yuzu.yuzu_emu.databinding.FragmentLosslessManagerBinding
|
||||||
|
import org.yuzu.yuzu_emu.features.fetcher.SpacingItemDecoration
|
||||||
|
import org.yuzu.yuzu_emu.model.HomeSetting
|
||||||
|
import org.yuzu.yuzu_emu.utils.LosslessScalingHelper
|
||||||
|
import org.yuzu.yuzu_emu.utils.ViewUtils.updateMargins
|
||||||
|
import org.yuzu.yuzu_emu.utils.collect
|
||||||
|
|
||||||
|
class LosslessManagerFragment : Fragment() {
|
||||||
|
private var _binding: FragmentLosslessManagerBinding? = null
|
||||||
|
private val binding get() = _binding!!
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
enterTransition = MaterialSharedAxis(MaterialSharedAxis.X, true)
|
||||||
|
returnTransition = MaterialSharedAxis(MaterialSharedAxis.X, false)
|
||||||
|
reenterTransition = MaterialSharedAxis(MaterialSharedAxis.X, false)
|
||||||
|
exitTransition = MaterialSharedAxis(MaterialSharedAxis.X, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View {
|
||||||
|
_binding = FragmentLosslessManagerBinding.inflate(inflater, container, false)
|
||||||
|
return binding.root
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
|
binding.toolbarLossless.setNavigationOnClickListener {
|
||||||
|
requireActivity().onBackPressedDispatcher.onBackPressed()
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.losslessOptionsList.apply {
|
||||||
|
layoutManager =
|
||||||
|
GridLayoutManager(requireContext(), resources.getInteger(R.integer.grid_columns))
|
||||||
|
addItemDecoration(
|
||||||
|
SpacingItemDecoration(resources.getDimensionPixelSize(R.dimen.spacing_small))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
LosslessScalingHelper.statusText.collect(viewLifecycleOwner) { refreshOptions() }
|
||||||
|
|
||||||
|
setInsets()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun refreshOptions() {
|
||||||
|
binding.losslessOptionsList.adapter = HomeSettingAdapter(
|
||||||
|
requireActivity() as AppCompatActivity,
|
||||||
|
viewLifecycleOwner,
|
||||||
|
buildOptions()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun buildOptions(): List<HomeSetting> {
|
||||||
|
val installed = LosslessScalingHelper.isInstalled()
|
||||||
|
return listOf(
|
||||||
|
HomeSetting(
|
||||||
|
if (installed) R.string.lossless_scaling_replace else R.string.lossless_scaling_install,
|
||||||
|
if (installed) {
|
||||||
|
R.string.lossless_scaling_replace_description
|
||||||
|
} else {
|
||||||
|
R.string.lossless_scaling_install_description
|
||||||
|
},
|
||||||
|
R.drawable.ic_install,
|
||||||
|
{ dllPickerLauncher.launch(arrayOf("*/*")) },
|
||||||
|
{ !NativeLibrary.isRunning() },
|
||||||
|
R.string.lossless_scaling_locked,
|
||||||
|
R.string.lossless_scaling_locked_description,
|
||||||
|
LosslessScalingHelper.statusText
|
||||||
|
),
|
||||||
|
HomeSetting(
|
||||||
|
R.string.lossless_scaling_remove,
|
||||||
|
R.string.lossless_scaling_remove_description,
|
||||||
|
R.drawable.ic_delete,
|
||||||
|
{ confirmRemoval() },
|
||||||
|
{ installed && !NativeLibrary.isRunning() },
|
||||||
|
if (installed) {
|
||||||
|
R.string.lossless_scaling_locked
|
||||||
|
} else {
|
||||||
|
R.string.lossless_scaling_remove_unavailable
|
||||||
|
},
|
||||||
|
if (installed) {
|
||||||
|
R.string.lossless_scaling_locked_description
|
||||||
|
} else {
|
||||||
|
R.string.lossless_scaling_remove_unavailable_description
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun confirmRemoval() {
|
||||||
|
MessageDialogFragment.newInstance(
|
||||||
|
requireActivity(),
|
||||||
|
titleId = R.string.lossless_scaling_remove,
|
||||||
|
descriptionId = R.string.lossless_scaling_remove_confirmation,
|
||||||
|
positiveButtonTitleId = R.string.lossless_scaling_remove,
|
||||||
|
positiveAction = { LosslessScalingHelper.remove() },
|
||||||
|
showNegativeButton = true,
|
||||||
|
negativeAction = {}
|
||||||
|
).show(parentFragmentManager, MessageDialogFragment.TAG)
|
||||||
|
}
|
||||||
|
|
||||||
|
private val dllPickerLauncher =
|
||||||
|
registerForActivityResult(ActivityResultContracts.OpenDocument()) { result ->
|
||||||
|
if (result == null) {
|
||||||
|
return@registerForActivityResult
|
||||||
|
}
|
||||||
|
|
||||||
|
val resultStrings = resources.getStringArray(R.array.losslessDllResults)
|
||||||
|
ProgressDialogFragment.newInstance(
|
||||||
|
requireActivity(),
|
||||||
|
R.string.lossless_scaling_installing,
|
||||||
|
false
|
||||||
|
) { _, _ ->
|
||||||
|
val installResult = LosslessScalingHelper.install(result)
|
||||||
|
if (installResult == LosslessScalingHelper.RESULT_OK) {
|
||||||
|
getString(R.string.lossless_scaling_install_success)
|
||||||
|
} else {
|
||||||
|
MessageDialogFragment.newInstance(
|
||||||
|
titleId = R.string.lossless_scaling_install_failed,
|
||||||
|
descriptionString = resultStrings[installResult]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}.show(parentFragmentManager, ProgressDialogFragment.TAG)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroyView() {
|
||||||
|
super.onDestroyView()
|
||||||
|
_binding = null
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setInsets() =
|
||||||
|
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { _, windowInsets ->
|
||||||
|
val barInsets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||||
|
val cutoutInsets = windowInsets.getInsets(WindowInsetsCompat.Type.displayCutout())
|
||||||
|
|
||||||
|
binding.appbarLossless.updateMargins(
|
||||||
|
left = barInsets.left + cutoutInsets.left,
|
||||||
|
right = barInsets.right + cutoutInsets.right
|
||||||
|
)
|
||||||
|
|
||||||
|
binding.scrollViewLossless.updatePadding(bottom = barInsets.bottom)
|
||||||
|
|
||||||
|
binding.losslessOptionsList.updatePadding(
|
||||||
|
left = barInsets.left + cutoutInsets.left,
|
||||||
|
right = barInsets.right + cutoutInsets.right
|
||||||
|
)
|
||||||
|
|
||||||
|
windowInsets
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -205,7 +205,7 @@ class SetupFragment : Fragment() {
|
||||||
)
|
)
|
||||||
add(
|
add(
|
||||||
PageButton(
|
PageButton(
|
||||||
R.drawable.ic_frames,
|
R.drawable.ic_duck,
|
||||||
R.string.lossless_scaling,
|
R.string.lossless_scaling,
|
||||||
R.string.lossless_scaling_setup_description,
|
R.string.lossless_scaling_setup_description,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/colorSurface">
|
||||||
|
|
||||||
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
android:id="@+id/appbar_lossless"
|
||||||
|
style="@style/Widget.Eden.TransparentTopAppBarLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
|
android:touchscreenBlocksFocus="false"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<com.google.android.material.appbar.MaterialToolbar
|
||||||
|
android:id="@+id/toolbar_lossless"
|
||||||
|
style="@style/Widget.Eden.TransparentTopToolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
android:touchscreenBlocksFocus="false"
|
||||||
|
app:navigationIcon="@drawable/ic_back"
|
||||||
|
app:title="@string/lossless_scaling" />
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
<androidx.core.widget.NestedScrollView
|
||||||
|
android:id="@+id/scroll_view_lossless"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:defaultFocusHighlightEnabled="false"
|
||||||
|
android:fadeScrollbars="false"
|
||||||
|
android:scrollbars="vertical"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/appbar_lossless">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingHorizontal="16dp"
|
||||||
|
android:paddingTop="16dp">
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/lossless_options_list"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:nestedScrollingEnabled="false" />
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
@ -47,6 +47,12 @@
|
||||||
android:defaultValue="@null" />
|
android:defaultValue="@null" />
|
||||||
</fragment>
|
</fragment>
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/losslessManagerFragment"
|
||||||
|
android:name="org.yuzu.yuzu_emu.fragments.LosslessManagerFragment"
|
||||||
|
android:label="@string/lossless_scaling"
|
||||||
|
tools:layout="@layout/fragment_lossless_manager" />
|
||||||
|
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/appletLauncherFragment"
|
android:id="@+id/appletLauncherFragment"
|
||||||
android:name="org.yuzu.yuzu_emu.fragments.AppletLauncherFragment"
|
android:name="org.yuzu.yuzu_emu.fragments.AppletLauncherFragment"
|
||||||
|
|
|
||||||
|
|
@ -299,7 +299,7 @@
|
||||||
<string name="gpu_driver_manager">GPU driver manager</string>
|
<string name="gpu_driver_manager">GPU driver manager</string>
|
||||||
<string name="install_gpu_driver_description">Install alternative drivers for potentially better performance or accuracy</string>
|
<string name="install_gpu_driver_description">Install alternative drivers for potentially better performance or accuracy</string>
|
||||||
<string name="frame_gen">Frame generation</string>
|
<string name="frame_gen">Frame generation</string>
|
||||||
<string name="frame_gen_submenu_description">Manage and configure frame generation</string>
|
<string name="frame_gen_per_game_description">Configure frame generation for this game</string>
|
||||||
<string name="frame_gen_description">Insert interpolated frames between rendered ones using Lossless Scaling. Forces FIFO presentation while enabled.</string>
|
<string name="frame_gen_description">Insert interpolated frames between rendered ones using Lossless Scaling. Forces FIFO presentation while enabled.</string>
|
||||||
<string name="frame_gen_multiplier">Frame multiplier</string>
|
<string name="frame_gen_multiplier">Frame multiplier</string>
|
||||||
<string name="frame_gen_multiplier_description">How many frames to display for each rendered frame. Higher values cost proportionally more GPU time. Asking for more than your display can present will slow emulation down.</string>
|
<string name="frame_gen_multiplier_description">How many frames to display for each rendered frame. Higher values cost proportionally more GPU time. Asking for more than your display can present will slow emulation down.</string>
|
||||||
|
|
@ -345,6 +345,12 @@
|
||||||
<string name="lossless_scaling_remove">Remove</string>
|
<string name="lossless_scaling_remove">Remove</string>
|
||||||
<string name="lossless_scaling_remove_description">Delete the installed Lossless.dll and its prepared shaders</string>
|
<string name="lossless_scaling_remove_description">Delete the installed Lossless.dll and its prepared shaders</string>
|
||||||
<string name="lossless_scaling_remove_confirmation">Frame generation will stop working until you install Lossless.dll again. Your original file is not affected.</string>
|
<string name="lossless_scaling_remove_confirmation">Frame generation will stop working until you install Lossless.dll again. Your original file is not affected.</string>
|
||||||
|
<string name="lossless_scaling_missing">Lossless.dll not installed</string>
|
||||||
|
<string name="lossless_scaling_missing_description">Install it from Settings › Lossless Scaling to use frame generation.</string>
|
||||||
|
<string name="lossless_scaling_locked">Close the game first</string>
|
||||||
|
<string name="lossless_scaling_locked_description">Lossless.dll cannot be changed while a game is running.</string>
|
||||||
|
<string name="lossless_scaling_remove_unavailable">Nothing to remove</string>
|
||||||
|
<string name="lossless_scaling_remove_unavailable_description">Lossless.dll is not installed yet.</string>
|
||||||
<string name="lossless_scaling_installing">Preparing frame generation shaders…</string>
|
<string name="lossless_scaling_installing">Preparing frame generation shaders…</string>
|
||||||
<string name="lossless_scaling_install_success">Lossless.dll installed successfully</string>
|
<string name="lossless_scaling_install_success">Lossless.dll installed successfully</string>
|
||||||
<string name="lossless_scaling_install_failed">Could not install Lossless.dll</string>
|
<string name="lossless_scaling_install_failed">Could not install Lossless.dll</string>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue