diff options
Diffstat (limited to 'src')
5 files changed, 43 insertions, 12 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AddGameFolderDialogFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AddGameFolderDialogFragment.kt index dec2b7cf1..9fab88248 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AddGameFolderDialogFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AddGameFolderDialogFragment.kt | |||
| @@ -14,8 +14,10 @@ import org.yuzu.yuzu_emu.R | |||
| 14 | import org.yuzu.yuzu_emu.databinding.DialogAddFolderBinding | 14 | import org.yuzu.yuzu_emu.databinding.DialogAddFolderBinding |
| 15 | import org.yuzu.yuzu_emu.model.GameDir | 15 | import org.yuzu.yuzu_emu.model.GameDir |
| 16 | import org.yuzu.yuzu_emu.model.GamesViewModel | 16 | import org.yuzu.yuzu_emu.model.GamesViewModel |
| 17 | import org.yuzu.yuzu_emu.model.HomeViewModel | ||
| 17 | 18 | ||
| 18 | class AddGameFolderDialogFragment : DialogFragment() { | 19 | class AddGameFolderDialogFragment : DialogFragment() { |
| 20 | private val homeViewModel: HomeViewModel by activityViewModels() | ||
| 19 | private val gamesViewModel: GamesViewModel by activityViewModels() | 21 | private val gamesViewModel: GamesViewModel by activityViewModels() |
| 20 | 22 | ||
| 21 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | 23 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { |
| @@ -30,6 +32,7 @@ class AddGameFolderDialogFragment : DialogFragment() { | |||
| 30 | .setTitle(R.string.add_game_folder) | 32 | .setTitle(R.string.add_game_folder) |
| 31 | .setPositiveButton(android.R.string.ok) { _: DialogInterface, _: Int -> | 33 | .setPositiveButton(android.R.string.ok) { _: DialogInterface, _: Int -> |
| 32 | val newGameDir = GameDir(folderUriString!!, binding.deepScanSwitch.isChecked) | 34 | val newGameDir = GameDir(folderUriString!!, binding.deepScanSwitch.isChecked) |
| 35 | homeViewModel.setGamesDirSelected(true) | ||
| 33 | gamesViewModel.addFolder(newGameDir) | 36 | gamesViewModel.addFolder(newGameDir) |
| 34 | } | 37 | } |
| 35 | .setNegativeButton(android.R.string.cancel, null) | 38 | .setNegativeButton(android.R.string.cancel, null) |
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt index c4277735d..eb5edaa10 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/SetupFragment.kt | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | package org.yuzu.yuzu_emu.fragments | 4 | package org.yuzu.yuzu_emu.fragments |
| 5 | 5 | ||
| 6 | import android.Manifest | 6 | import android.Manifest |
| 7 | import android.annotation.SuppressLint | ||
| 7 | import android.content.Intent | 8 | import android.content.Intent |
| 8 | import android.os.Build | 9 | import android.os.Build |
| 9 | import android.os.Bundle | 10 | import android.os.Bundle |
| @@ -75,6 +76,8 @@ class SetupFragment : Fragment() { | |||
| 75 | return binding.root | 76 | return binding.root |
| 76 | } | 77 | } |
| 77 | 78 | ||
| 79 | // This is using the correct scope, lint is just acting up | ||
| 80 | @SuppressLint("UnsafeRepeatOnLifecycleDetector") | ||
| 78 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | 81 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
| 79 | mainActivity = requireActivity() as MainActivity | 82 | mainActivity = requireActivity() as MainActivity |
| 80 | 83 | ||
| @@ -206,12 +209,24 @@ class SetupFragment : Fragment() { | |||
| 206 | ) | 209 | ) |
| 207 | } | 210 | } |
| 208 | 211 | ||
| 209 | viewLifecycleOwner.lifecycleScope.launch { | 212 | viewLifecycleOwner.lifecycleScope.apply { |
| 210 | repeatOnLifecycle(Lifecycle.State.CREATED) { | 213 | launch { |
| 211 | homeViewModel.shouldPageForward.collect { | 214 | repeatOnLifecycle(Lifecycle.State.CREATED) { |
| 212 | if (it) { | 215 | homeViewModel.shouldPageForward.collect { |
| 213 | pageForward() | 216 | if (it) { |
| 214 | homeViewModel.setShouldPageForward(false) | 217 | pageForward() |
| 218 | homeViewModel.setShouldPageForward(false) | ||
| 219 | } | ||
| 220 | } | ||
| 221 | } | ||
| 222 | } | ||
| 223 | launch { | ||
| 224 | repeatOnLifecycle(Lifecycle.State.CREATED) { | ||
| 225 | homeViewModel.gamesDirSelected.collect { | ||
| 226 | if (it) { | ||
| 227 | gamesDirCallback.onStepCompleted() | ||
| 228 | homeViewModel.setGamesDirSelected(false) | ||
| 229 | } | ||
| 215 | } | 230 | } |
| 216 | } | 231 | } |
| 217 | } | 232 | } |
| @@ -339,7 +354,6 @@ class SetupFragment : Fragment() { | |||
| 339 | registerForActivityResult(ActivityResultContracts.OpenDocumentTree()) { result -> | 354 | registerForActivityResult(ActivityResultContracts.OpenDocumentTree()) { result -> |
| 340 | if (result != null) { | 355 | if (result != null) { |
| 341 | mainActivity.processGamesDir(result) | 356 | mainActivity.processGamesDir(result) |
| 342 | gamesDirCallback.onStepCompleted() | ||
| 343 | } | 357 | } |
| 344 | } | 358 | } |
| 345 | 359 | ||
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/GamesViewModel.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/GamesViewModel.kt index 752d98c10..fd925235b 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/GamesViewModel.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/GamesViewModel.kt | |||
| @@ -133,7 +133,7 @@ class GamesViewModel : ViewModel() { | |||
| 133 | viewModelScope.launch { | 133 | viewModelScope.launch { |
| 134 | withContext(Dispatchers.IO) { | 134 | withContext(Dispatchers.IO) { |
| 135 | NativeConfig.addGameDir(gameDir) | 135 | NativeConfig.addGameDir(gameDir) |
| 136 | getGameDirs() | 136 | getGameDirs(true) |
| 137 | } | 137 | } |
| 138 | } | 138 | } |
| 139 | 139 | ||
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/HomeViewModel.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/HomeViewModel.kt index 251b5a667..07e65b028 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/HomeViewModel.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/HomeViewModel.kt | |||
| @@ -6,6 +6,7 @@ package org.yuzu.yuzu_emu.model | |||
| 6 | import androidx.lifecycle.ViewModel | 6 | import androidx.lifecycle.ViewModel |
| 7 | import kotlinx.coroutines.flow.MutableStateFlow | 7 | import kotlinx.coroutines.flow.MutableStateFlow |
| 8 | import kotlinx.coroutines.flow.StateFlow | 8 | import kotlinx.coroutines.flow.StateFlow |
| 9 | import kotlinx.coroutines.flow.asStateFlow | ||
| 9 | 10 | ||
| 10 | class HomeViewModel : ViewModel() { | 11 | class HomeViewModel : ViewModel() { |
| 11 | val navigationVisible: StateFlow<Pair<Boolean, Boolean>> get() = _navigationVisible | 12 | val navigationVisible: StateFlow<Pair<Boolean, Boolean>> get() = _navigationVisible |
| @@ -17,6 +18,9 @@ class HomeViewModel : ViewModel() { | |||
| 17 | val shouldPageForward: StateFlow<Boolean> get() = _shouldPageForward | 18 | val shouldPageForward: StateFlow<Boolean> get() = _shouldPageForward |
| 18 | private val _shouldPageForward = MutableStateFlow(false) | 19 | private val _shouldPageForward = MutableStateFlow(false) |
| 19 | 20 | ||
| 21 | private val _gamesDirSelected = MutableStateFlow(false) | ||
| 22 | val gamesDirSelected get() = _gamesDirSelected.asStateFlow() | ||
| 23 | |||
| 20 | var navigatedToSetup = false | 24 | var navigatedToSetup = false |
| 21 | 25 | ||
| 22 | fun setNavigationVisibility(visible: Boolean, animated: Boolean) { | 26 | fun setNavigationVisibility(visible: Boolean, animated: Boolean) { |
| @@ -36,4 +40,8 @@ class HomeViewModel : ViewModel() { | |||
| 36 | fun setShouldPageForward(pageForward: Boolean) { | 40 | fun setShouldPageForward(pageForward: Boolean) { |
| 37 | _shouldPageForward.value = pageForward | 41 | _shouldPageForward.value = pageForward |
| 38 | } | 42 | } |
| 43 | |||
| 44 | fun setGamesDirSelected(selected: Boolean) { | ||
| 45 | _gamesDirSelected.value = selected | ||
| 46 | } | ||
| 39 | } | 47 | } |
diff --git a/src/common/settings.h b/src/common/settings.h index 98341ad96..7dc18fffe 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -180,14 +180,20 @@ struct Values { | |||
| 180 | &use_speed_limit}; | 180 | &use_speed_limit}; |
| 181 | 181 | ||
| 182 | // Cpu | 182 | // Cpu |
| 183 | SwitchableSetting<CpuBackend, true> cpu_backend{ | 183 | SwitchableSetting<CpuBackend, true> cpu_backend{linkage, |
| 184 | linkage, CpuBackend::Dynarmic, CpuBackend::Dynarmic, | ||
| 185 | #ifdef HAS_NCE | 184 | #ifdef HAS_NCE |
| 186 | CpuBackend::Nce, | 185 | CpuBackend::Nce, |
| 187 | #else | 186 | #else |
| 188 | CpuBackend::Dynarmic, | 187 | CpuBackend::Dynarmic, |
| 189 | #endif | 188 | #endif |
| 190 | "cpu_backend", Category::Cpu}; | 189 | CpuBackend::Dynarmic, |
| 190 | #ifdef HAS_NCE | ||
| 191 | CpuBackend::Nce, | ||
| 192 | #else | ||
| 193 | CpuBackend::Dynarmic, | ||
| 194 | #endif | ||
| 195 | "cpu_backend", | ||
| 196 | Category::Cpu}; | ||
| 191 | SwitchableSetting<CpuAccuracy, true> cpu_accuracy{linkage, CpuAccuracy::Auto, | 197 | SwitchableSetting<CpuAccuracy, true> cpu_accuracy{linkage, CpuAccuracy::Auto, |
| 192 | CpuAccuracy::Auto, CpuAccuracy::Paranoid, | 198 | CpuAccuracy::Auto, CpuAccuracy::Paranoid, |
| 193 | "cpu_accuracy", Category::Cpu}; | 199 | "cpu_accuracy", Category::Cpu}; |