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/ui/main/MainActivity.kt54
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GpuDriverHelper.kt7
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GpuDriverMetadata.kt1
-rw-r--r--src/android/app/src/main/res/values/strings.xml1
4 files changed, 42 insertions, 21 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt
index c5259a13d..dd8750c4f 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt
@@ -17,15 +17,21 @@ import androidx.core.view.ViewCompat
17import androidx.core.view.WindowCompat 17import androidx.core.view.WindowCompat
18import androidx.core.view.WindowInsetsCompat 18import androidx.core.view.WindowInsetsCompat
19import androidx.core.view.updatePadding 19import androidx.core.view.updatePadding
20import androidx.lifecycle.lifecycleScope
20import com.google.android.material.dialog.MaterialAlertDialogBuilder 21import com.google.android.material.dialog.MaterialAlertDialogBuilder
22import kotlinx.coroutines.Dispatchers
23import kotlinx.coroutines.launch
24import kotlinx.coroutines.withContext
21import org.yuzu.yuzu_emu.NativeLibrary 25import org.yuzu.yuzu_emu.NativeLibrary
22import org.yuzu.yuzu_emu.R 26import org.yuzu.yuzu_emu.R
23import org.yuzu.yuzu_emu.activities.EmulationActivity 27import org.yuzu.yuzu_emu.activities.EmulationActivity
24import org.yuzu.yuzu_emu.databinding.ActivityMainBinding 28import org.yuzu.yuzu_emu.databinding.ActivityMainBinding
29import org.yuzu.yuzu_emu.databinding.DialogProgressBarBinding
25import org.yuzu.yuzu_emu.features.settings.ui.SettingsActivity 30import org.yuzu.yuzu_emu.features.settings.ui.SettingsActivity
26import org.yuzu.yuzu_emu.model.GameProvider 31import org.yuzu.yuzu_emu.model.GameProvider
27import org.yuzu.yuzu_emu.ui.platform.PlatformGamesFragment 32import org.yuzu.yuzu_emu.ui.platform.PlatformGamesFragment
28import org.yuzu.yuzu_emu.utils.* 33import org.yuzu.yuzu_emu.utils.*
34import java.io.IOException
29 35
30class MainActivity : AppCompatActivity(), MainView { 36class MainActivity : AppCompatActivity(), MainView {
31 private var platformGamesFragment: PlatformGamesFragment? = null 37 private var platformGamesFragment: PlatformGamesFragment? = null
@@ -200,20 +206,40 @@ class MainActivity : AppCompatActivity(), MainView {
200 Uri.parse(result!!.dataString), 206 Uri.parse(result!!.dataString),
201 takeFlags 207 takeFlags
202 ) 208 )
203 GpuDriverHelper.installCustomDriver(this, result.data) 209
204 val driverName = GpuDriverHelper.customDriverName 210 val progressBinding = DialogProgressBarBinding.inflate(layoutInflater)
205 if (driverName != null) { 211 progressBinding.progressBar.isIndeterminate = true
206 Toast.makeText( 212 val installationDialog = MaterialAlertDialogBuilder(this)
207 this, 213 .setTitle(R.string.installing_driver)
208 getString(R.string.select_gpu_driver_install_success, driverName), 214 .setView(progressBinding.root)
209 Toast.LENGTH_SHORT 215 .show()
210 ).show() 216
211 } else { 217 lifecycleScope.launch {
212 Toast.makeText( 218 withContext(Dispatchers.IO) {
213 this, 219 // Ignore file exceptions when a user selects an invalid zip
214 R.string.select_gpu_driver_error, 220 try {
215 Toast.LENGTH_LONG 221 GpuDriverHelper.installCustomDriver(applicationContext, result.data)
216 ).show() 222 } catch (_: IOException) {}
223
224 withContext(Dispatchers.Main) {
225 installationDialog.dismiss()
226
227 val driverName = GpuDriverHelper.customDriverName
228 if (driverName != null) {
229 Toast.makeText(
230 applicationContext,
231 getString(R.string.select_gpu_driver_install_success, driverName),
232 Toast.LENGTH_SHORT
233 ).show()
234 } else {
235 Toast.makeText(
236 applicationContext,
237 R.string.select_gpu_driver_error,
238 Toast.LENGTH_LONG
239 ).show()
240 }
241 }
242 }
217 } 243 }
218 } 244 }
219 } 245 }
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GpuDriverHelper.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GpuDriverHelper.kt
index bf26ab51e..598c6808b 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GpuDriverHelper.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GpuDriverHelper.kt
@@ -98,11 +98,7 @@ object GpuDriverHelper {
98 ) 98 )
99 99
100 // Unzip the driver. 100 // Unzip the driver.
101 try { 101 unzip(driverInstallationPath + DRIVER_INTERNAL_FILENAME, driverInstallationPath!!)
102 unzip(driverInstallationPath + DRIVER_INTERNAL_FILENAME, driverInstallationPath!!)
103 } catch (e: IOException) {
104 throw RuntimeException(e)
105 }
106 102
107 // Initialize the driver parameters. 103 // Initialize the driver parameters.
108 initializeDriverParameters(context) 104 initializeDriverParameters(context)
@@ -111,7 +107,6 @@ object GpuDriverHelper {
111 // Parse the custom driver metadata to retrieve the name. 107 // Parse the custom driver metadata to retrieve the name.
112 val customDriverName: String? 108 val customDriverName: String?
113 get() { 109 get() {
114 // Parse the custom driver metadata to retrieve the name.
115 val metadata = GpuDriverMetadata(driverInstallationPath + META_JSON_FILENAME) 110 val metadata = GpuDriverMetadata(driverInstallationPath + META_JSON_FILENAME)
116 return metadata.name 111 return metadata.name
117 } 112 }
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GpuDriverMetadata.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GpuDriverMetadata.kt
index d3849d138..70bdb4097 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GpuDriverMetadata.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GpuDriverMetadata.kt
@@ -29,7 +29,6 @@ class GpuDriverMetadata(metadataFilePath: String) {
29 driverVersion = json.getString("driverVersion") 29 driverVersion = json.getString("driverVersion")
30 minApi = json.getInt("minApi") 30 minApi = json.getInt("minApi")
31 libraryName = json.getString("libraryName") 31 libraryName = json.getString("libraryName")
32 Log.info("Guh")
33 } catch (e: JSONException) { 32 } catch (e: JSONException) {
34 // JSON is malformed, ignore and treat as unsupported metadata. 33 // JSON is malformed, ignore and treat as unsupported metadata.
35 } catch (e: IOException) { 34 } catch (e: IOException) {
diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml
index fbf8fe9c1..abf75cca8 100644
--- a/src/android/app/src/main/res/values/strings.xml
+++ b/src/android/app/src/main/res/values/strings.xml
@@ -68,6 +68,7 @@
68 <string name="select_gpu_driver_use_default">Using default GPU driver</string> 68 <string name="select_gpu_driver_use_default">Using default GPU driver</string>
69 <string name="select_gpu_driver_error">Invalid driver selected, using system default!</string> 69 <string name="select_gpu_driver_error">Invalid driver selected, using system default!</string>
70 <string name="system_gpu_driver">System GPU driver</string> 70 <string name="system_gpu_driver">System GPU driver</string>
71 <string name="installing_driver">Installing driver…</string>
71 72
72 <!-- Preferences Screen --> 73 <!-- Preferences Screen -->
73 <string name="preferences_settings">Settings</string> 74 <string name="preferences_settings">Settings</string>