summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt26
-rw-r--r--src/android/app/src/main/res/values/strings.xml1
2 files changed, 23 insertions, 4 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 750638bc9..aa9cea442 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
@@ -17,6 +17,7 @@ import android.os.Handler
17import android.os.Looper 17import android.os.Looper
18import android.view.* 18import android.view.*
19import android.widget.TextView 19import android.widget.TextView
20import android.widget.Toast
20import androidx.activity.OnBackPressedCallback 21import androidx.activity.OnBackPressedCallback
21import androidx.appcompat.widget.PopupMenu 22import androidx.appcompat.widget.PopupMenu
22import androidx.core.content.res.ResourcesCompat 23import androidx.core.content.res.ResourcesCompat
@@ -53,6 +54,7 @@ import org.yuzu.yuzu_emu.model.Game
53import org.yuzu.yuzu_emu.model.EmulationViewModel 54import org.yuzu.yuzu_emu.model.EmulationViewModel
54import org.yuzu.yuzu_emu.overlay.InputOverlay 55import org.yuzu.yuzu_emu.overlay.InputOverlay
55import org.yuzu.yuzu_emu.utils.* 56import org.yuzu.yuzu_emu.utils.*
57import java.lang.NullPointerException
56 58
57class EmulationFragment : Fragment(), SurfaceHolder.Callback { 59class EmulationFragment : Fragment(), SurfaceHolder.Callback {
58 private lateinit var preferences: SharedPreferences 60 private lateinit var preferences: SharedPreferences
@@ -104,10 +106,21 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
104 null 106 null
105 } 107 }
106 } 108 }
107 game = if (args.game != null) { 109
108 args.game!! 110 try {
109 } else { 111 game = if (args.game != null) {
110 intentGame ?: error("[EmulationFragment] No bootable game present!") 112 args.game!!
113 } else {
114 intentGame!!
115 }
116 } catch (e: NullPointerException) {
117 Toast.makeText(
118 requireContext(),
119 R.string.no_game_present,
120 Toast.LENGTH_SHORT
121 ).show()
122 requireActivity().finish()
123 return
111 } 124 }
112 125
113 // So this fragment doesn't restart on configuration changes; i.e. rotation. 126 // So this fragment doesn't restart on configuration changes; i.e. rotation.
@@ -131,6 +144,11 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
131 // This is using the correct scope, lint is just acting up 144 // This is using the correct scope, lint is just acting up
132 @SuppressLint("UnsafeRepeatOnLifecycleDetector") 145 @SuppressLint("UnsafeRepeatOnLifecycleDetector")
133 override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 146 override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
147 super.onViewCreated(view, savedInstanceState)
148 if (requireActivity().isFinishing) {
149 return
150 }
151
134 binding.surfaceEmulation.holder.addCallback(this) 152 binding.surfaceEmulation.holder.addCallback(this)
135 binding.showFpsText.setTextColor(Color.YELLOW) 153 binding.showFpsText.setTextColor(Color.YELLOW)
136 binding.doneControlConfig.setOnClickListener { stopConfiguringControls() } 154 binding.doneControlConfig.setOnClickListener { stopConfiguringControls() }
diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml
index 574290479..034761401 100644
--- a/src/android/app/src/main/res/values/strings.xml
+++ b/src/android/app/src/main/res/values/strings.xml
@@ -294,6 +294,7 @@
294 <string name="performance_warning">Turning off this setting will significantly reduce emulation performance! For the best experience, it is recommended that you leave this setting enabled.</string> 294 <string name="performance_warning">Turning off this setting will significantly reduce emulation performance! For the best experience, it is recommended that you leave this setting enabled.</string>
295 <string name="device_memory_inadequate">Device RAM: %1$s\nRecommended: %2$s</string> 295 <string name="device_memory_inadequate">Device RAM: %1$s\nRecommended: %2$s</string>
296 <string name="memory_formatted">%1$s %2$s</string> 296 <string name="memory_formatted">%1$s %2$s</string>
297 <string name="no_game_present">No bootable game present!</string>
297 298
298 <!-- Region Names --> 299 <!-- Region Names -->
299 <string name="region_japan">Japan</string> 300 <string name="region_japan">Japan</string>