diff options
3 files changed, 57 insertions, 16 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt index 598a9d42b..07bd78bf7 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt | |||
| @@ -15,6 +15,7 @@ import android.net.Uri | |||
| 15 | import android.os.Bundle | 15 | import android.os.Bundle |
| 16 | import android.os.Handler | 16 | import android.os.Handler |
| 17 | import android.os.Looper | 17 | import android.os.Looper |
| 18 | import android.os.SystemClock | ||
| 18 | import android.view.* | 19 | import android.view.* |
| 19 | import android.widget.TextView | 20 | import android.widget.TextView |
| 20 | import android.widget.Toast | 21 | import android.widget.Toast |
| @@ -25,6 +26,7 @@ import androidx.core.graphics.Insets | |||
| 25 | import androidx.core.view.ViewCompat | 26 | import androidx.core.view.ViewCompat |
| 26 | import androidx.core.view.WindowInsetsCompat | 27 | import androidx.core.view.WindowInsetsCompat |
| 27 | import androidx.drawerlayout.widget.DrawerLayout | 28 | import androidx.drawerlayout.widget.DrawerLayout |
| 29 | import androidx.drawerlayout.widget.DrawerLayout.DrawerListener | ||
| 28 | import androidx.fragment.app.Fragment | 30 | import androidx.fragment.app.Fragment |
| 29 | import androidx.fragment.app.activityViewModels | 31 | import androidx.fragment.app.activityViewModels |
| 30 | import androidx.lifecycle.Lifecycle | 32 | import androidx.lifecycle.Lifecycle |
| @@ -156,6 +158,32 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback { | |||
| 156 | binding.showFpsText.setTextColor(Color.YELLOW) | 158 | binding.showFpsText.setTextColor(Color.YELLOW) |
| 157 | binding.doneControlConfig.setOnClickListener { stopConfiguringControls() } | 159 | binding.doneControlConfig.setOnClickListener { stopConfiguringControls() } |
| 158 | 160 | ||
| 161 | binding.drawerLayout.addDrawerListener(object : DrawerListener { | ||
| 162 | override fun onDrawerSlide(drawerView: View, slideOffset: Float) { | ||
| 163 | binding.surfaceInputOverlay.dispatchTouchEvent( | ||
| 164 | MotionEvent.obtain( | ||
| 165 | SystemClock.uptimeMillis(), | ||
| 166 | SystemClock.uptimeMillis() + 100, | ||
| 167 | MotionEvent.ACTION_UP, | ||
| 168 | 0f, | ||
| 169 | 0f, | ||
| 170 | 0 | ||
| 171 | ) | ||
| 172 | ) | ||
| 173 | } | ||
| 174 | |||
| 175 | override fun onDrawerOpened(drawerView: View) { | ||
| 176 | // No op | ||
| 177 | } | ||
| 178 | |||
| 179 | override fun onDrawerClosed(drawerView: View) { | ||
| 180 | // No op | ||
| 181 | } | ||
| 182 | |||
| 183 | override fun onDrawerStateChanged(newState: Int) { | ||
| 184 | // No op | ||
| 185 | } | ||
| 186 | }) | ||
| 159 | binding.drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED) | 187 | binding.drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED) |
| 160 | binding.inGameMenu.getHeaderView(0).findViewById<TextView>(R.id.text_game_title).text = | 188 | binding.inGameMenu.getHeaderView(0).findViewById<TextView>(R.id.text_game_title).text = |
| 161 | game.title | 189 | game.title |
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 6e09fa81d..004b25b04 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 | |||
| @@ -49,26 +49,33 @@ class GamesViewModel : ViewModel() { | |||
| 49 | // Retrieve list of cached games | 49 | // Retrieve list of cached games |
| 50 | val storedGames = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext) | 50 | val storedGames = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext) |
| 51 | .getStringSet(GameHelper.KEY_GAMES, emptySet()) | 51 | .getStringSet(GameHelper.KEY_GAMES, emptySet()) |
| 52 | if (storedGames!!.isNotEmpty()) { | ||
| 53 | val deserializedGames = mutableSetOf<Game>() | ||
| 54 | storedGames.forEach { | ||
| 55 | val game: Game | ||
| 56 | try { | ||
| 57 | game = Json.decodeFromString(it) | ||
| 58 | } catch (e: MissingFieldException) { | ||
| 59 | return@forEach | ||
| 60 | } | ||
| 61 | 52 | ||
| 62 | val gameExists = | 53 | viewModelScope.launch { |
| 63 | DocumentFile.fromSingleUri(YuzuApplication.appContext, Uri.parse(game.path)) | 54 | withContext(Dispatchers.IO) { |
| 64 | ?.exists() | 55 | if (storedGames!!.isNotEmpty()) { |
| 65 | if (gameExists == true) { | 56 | val deserializedGames = mutableSetOf<Game>() |
| 66 | deserializedGames.add(game) | 57 | storedGames.forEach { |
| 58 | val game: Game | ||
| 59 | try { | ||
| 60 | game = Json.decodeFromString(it) | ||
| 61 | } catch (e: MissingFieldException) { | ||
| 62 | return@forEach | ||
| 63 | } | ||
| 64 | |||
| 65 | val gameExists = | ||
| 66 | DocumentFile.fromSingleUri( | ||
| 67 | YuzuApplication.appContext, | ||
| 68 | Uri.parse(game.path) | ||
| 69 | )?.exists() | ||
| 70 | if (gameExists == true) { | ||
| 71 | deserializedGames.add(game) | ||
| 72 | } | ||
| 73 | } | ||
| 74 | setGames(deserializedGames.toList()) | ||
| 67 | } | 75 | } |
| 76 | reloadGames(false) | ||
| 68 | } | 77 | } |
| 69 | setGames(deserializedGames.toList()) | ||
| 70 | } | 78 | } |
| 71 | reloadGames(false) | ||
| 72 | } | 79 | } |
| 73 | 80 | ||
| 74 | fun setGames(games: List<Game>) { | 81 | fun setGames(games: List<Game>) { |
diff --git a/src/video_core/renderer_vulkan/vk_swapchain.cpp b/src/video_core/renderer_vulkan/vk_swapchain.cpp index 81ef98f61..821f44f1a 100644 --- a/src/video_core/renderer_vulkan/vk_swapchain.cpp +++ b/src/video_core/renderer_vulkan/vk_swapchain.cpp | |||
| @@ -147,6 +147,9 @@ bool Swapchain::AcquireNextImage() { | |||
| 147 | case VK_ERROR_OUT_OF_DATE_KHR: | 147 | case VK_ERROR_OUT_OF_DATE_KHR: |
| 148 | is_outdated = true; | 148 | is_outdated = true; |
| 149 | break; | 149 | break; |
| 150 | case VK_ERROR_SURFACE_LOST_KHR: | ||
| 151 | vk::Check(result); | ||
| 152 | break; | ||
| 150 | default: | 153 | default: |
| 151 | LOG_ERROR(Render_Vulkan, "vkAcquireNextImageKHR returned {}", vk::ToString(result)); | 154 | LOG_ERROR(Render_Vulkan, "vkAcquireNextImageKHR returned {}", vk::ToString(result)); |
| 152 | break; | 155 | break; |
| @@ -180,6 +183,9 @@ void Swapchain::Present(VkSemaphore render_semaphore) { | |||
| 180 | case VK_ERROR_OUT_OF_DATE_KHR: | 183 | case VK_ERROR_OUT_OF_DATE_KHR: |
| 181 | is_outdated = true; | 184 | is_outdated = true; |
| 182 | break; | 185 | break; |
| 186 | case VK_ERROR_SURFACE_LOST_KHR: | ||
| 187 | vk::Check(result); | ||
| 188 | break; | ||
| 183 | default: | 189 | default: |
| 184 | LOG_CRITICAL(Render_Vulkan, "Failed to present with error {}", vk::ToString(result)); | 190 | LOG_CRITICAL(Render_Vulkan, "Failed to present with error {}", vk::ToString(result)); |
| 185 | break; | 191 | break; |