Firmware 20.0.0 Initial Implementation & Android: Uninstall Firmware Button

Co-authored-by: Pavel Barabanov <pavelbarabanov94@gmail.com>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/89
Co-authored-by: crueter <crueter@noreply.localhost>
Co-committed-by: crueter <crueter@noreply.localhost>
This commit is contained in:
crueter 2025-05-07 20:15:25 +00:00 committed by edendev
parent 668bcb94db
commit 4661909f4c
18 changed files with 155 additions and 20 deletions

View file

@ -133,6 +133,11 @@ class InstallableFragment : Fragment() {
R.string.install_firmware_description,
install = { mainActivity.getFirmware.launch(arrayOf("application/zip")) }
),
Installable(
R.string.uninstall_firmware,
R.string.uninstall_firmware_description,
install = { mainActivity.uninstallFirmware() }
),
Installable(
R.string.install_prod_keys,
R.string.install_prod_keys_description,

View file

@ -376,7 +376,31 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
messageToShow
}.show(supportFragmentManager, ProgressDialogFragment.TAG)
}
fun uninstallFirmware() {
val firmwarePath = File(DirectoryInitialization.userDirectory + "/nand/system/Contents/registered/")
ProgressDialogFragment.newInstance(
this,
R.string.firmware_uninstalling
) { progressCallback, _ ->
var messageToShow: Any
try {
// Ensure the firmware directory exists before attempting to delete
if (firmwarePath.exists()) {
firmwarePath.deleteRecursively()
// Optionally reinitialize the system or perform other necessary steps
NativeLibrary.initializeSystem(true)
homeViewModel.setCheckKeys(true)
messageToShow = getString(R.string.firmware_uninstalled_success)
} else {
messageToShow = getString(R.string.firmware_uninstalled_failure)
}
} catch (e: Exception) {
Log.error("[MainActivity] Firmware uninstall failed - ${e.message}")
messageToShow = getString(R.string.fatal_error)
}
messageToShow
}.show(supportFragmentManager, ProgressDialogFragment.TAG)
}
val getAmiiboKey =
registerForActivityResult(ActivityResultContracts.OpenDocument()) { result ->
if (result == null) {

View file

@ -143,6 +143,11 @@
<string name="firmware_installed_success">Firmware installed successfully</string>
<string name="firmware_installed_failure">Firmware installation failed</string>
<string name="firmware_installed_failure_description">Make sure the firmware nca files are at the root of the zip and try again.</string>
<string name="uninstall_firmware">Uninstall firmware</string>
<string name="uninstall_firmware_description">Uninstalling the firmware will remove it from the device and may affect game compatibility.</string>
<string name="firmware_uninstalling">Uninstalling firmware</string>
<string name="firmware_uninstalled_success">Firmware uninstalled successfully</string>
<string name="firmware_uninstalled_failure">Firmware uninstallation failed</string>
<string name="share_log">Share debug logs</string>
<string name="share_log_description">Share eden\'s log file to debug issues</string>
<string name="share_log_missing">No log file found</string>