early-access version 3851
This commit is contained in:
parent
8d4ea17a0b
commit
26ef616d5c
6 changed files with 119 additions and 113 deletions
|
@ -1,7 +1,7 @@
|
||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 3850.
|
This is the source code for early-access 3851.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,8 @@ class HomeSettingAdapter(
|
||||||
holder.option.onClick.invoke()
|
holder.option.onClick.invoke()
|
||||||
} else {
|
} else {
|
||||||
MessageDialogFragment.newInstance(
|
MessageDialogFragment.newInstance(
|
||||||
holder.option.disabledTitleId,
|
titleId = holder.option.disabledTitleId,
|
||||||
holder.option.disabledMessageId
|
descriptionId = holder.option.disabledMessageId
|
||||||
).show(activity.supportFragmentManager, MessageDialogFragment.TAG)
|
).show(activity.supportFragmentManager, MessageDialogFragment.TAG)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,8 +187,8 @@ class ImportExportSavesFragment : DialogFragment() {
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
if (!validZip) {
|
if (!validZip) {
|
||||||
MessageDialogFragment.newInstance(
|
MessageDialogFragment.newInstance(
|
||||||
R.string.save_file_invalid_zip_structure,
|
titleId = R.string.save_file_invalid_zip_structure,
|
||||||
R.string.save_file_invalid_zip_structure_description
|
descriptionId = R.string.save_file_invalid_zip_structure_description
|
||||||
).show(activity.supportFragmentManager, MessageDialogFragment.TAG)
|
).show(activity.supportFragmentManager, MessageDialogFragment.TAG)
|
||||||
return@withContext
|
return@withContext
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ class IndeterminateProgressDialogFragment : DialogFragment() {
|
||||||
when (val result = taskViewModel.result.value) {
|
when (val result = taskViewModel.result.value) {
|
||||||
is String -> Toast.makeText(requireContext(), result, Toast.LENGTH_LONG).show()
|
is String -> Toast.makeText(requireContext(), result, Toast.LENGTH_LONG).show()
|
||||||
is MessageDialogFragment -> result.show(
|
is MessageDialogFragment -> result.show(
|
||||||
parentFragmentManager,
|
requireActivity().supportFragmentManager,
|
||||||
MessageDialogFragment.TAG
|
MessageDialogFragment.TAG
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,14 +13,20 @@ import org.yuzu.yuzu_emu.R
|
||||||
|
|
||||||
class MessageDialogFragment : DialogFragment() {
|
class MessageDialogFragment : DialogFragment() {
|
||||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
val titleId = requireArguments().getInt(TITLE)
|
val titleId = requireArguments().getInt(TITLE_ID)
|
||||||
val descriptionId = requireArguments().getInt(DESCRIPTION)
|
val titleString = requireArguments().getString(TITLE_STRING)!!
|
||||||
|
val descriptionId = requireArguments().getInt(DESCRIPTION_ID)
|
||||||
|
val descriptionString = requireArguments().getString(DESCRIPTION_STRING)!!
|
||||||
val helpLinkId = requireArguments().getInt(HELP_LINK)
|
val helpLinkId = requireArguments().getInt(HELP_LINK)
|
||||||
|
|
||||||
val dialog = MaterialAlertDialogBuilder(requireContext())
|
val dialog = MaterialAlertDialogBuilder(requireContext())
|
||||||
.setPositiveButton(R.string.close, null)
|
.setPositiveButton(R.string.close, null)
|
||||||
.setTitle(titleId)
|
|
||||||
.setMessage(descriptionId)
|
if (titleId != 0) dialog.setTitle(titleId)
|
||||||
|
if (titleString.isNotEmpty()) dialog.setTitle(titleString)
|
||||||
|
|
||||||
|
if (descriptionId != 0) dialog.setMessage(descriptionId)
|
||||||
|
if (descriptionString.isNotEmpty()) dialog.setMessage(descriptionString)
|
||||||
|
|
||||||
if (helpLinkId != 0) {
|
if (helpLinkId != 0) {
|
||||||
dialog.setNeutralButton(R.string.learn_more) { _, _ ->
|
dialog.setNeutralButton(R.string.learn_more) { _, _ ->
|
||||||
|
@ -39,20 +45,26 @@ class MessageDialogFragment : DialogFragment() {
|
||||||
companion object {
|
companion object {
|
||||||
const val TAG = "MessageDialogFragment"
|
const val TAG = "MessageDialogFragment"
|
||||||
|
|
||||||
private const val TITLE = "Title"
|
private const val TITLE_ID = "Title"
|
||||||
private const val DESCRIPTION = "Description"
|
private const val TITLE_STRING = "TitleString"
|
||||||
|
private const val DESCRIPTION_ID = "DescriptionId"
|
||||||
|
private const val DESCRIPTION_STRING = "DescriptionString"
|
||||||
private const val HELP_LINK = "Link"
|
private const val HELP_LINK = "Link"
|
||||||
|
|
||||||
fun newInstance(
|
fun newInstance(
|
||||||
titleId: Int,
|
titleId: Int = 0,
|
||||||
descriptionId: Int,
|
titleString: String = "",
|
||||||
|
descriptionId: Int = 0,
|
||||||
|
descriptionString: String = "",
|
||||||
helpLinkId: Int = 0
|
helpLinkId: Int = 0
|
||||||
): MessageDialogFragment {
|
): MessageDialogFragment {
|
||||||
val dialog = MessageDialogFragment()
|
val dialog = MessageDialogFragment()
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
bundle.apply {
|
bundle.apply {
|
||||||
putInt(TITLE, titleId)
|
putInt(TITLE_ID, titleId)
|
||||||
putInt(DESCRIPTION, descriptionId)
|
putString(TITLE_STRING, titleString)
|
||||||
|
putInt(DESCRIPTION_ID, descriptionId)
|
||||||
|
putString(DESCRIPTION_STRING, descriptionString)
|
||||||
putInt(HELP_LINK, helpLinkId)
|
putInt(HELP_LINK, helpLinkId)
|
||||||
}
|
}
|
||||||
dialog.arguments = bundle
|
dialog.arguments = bundle
|
||||||
|
|
|
@ -42,7 +42,6 @@ import org.yuzu.yuzu_emu.databinding.DialogProgressBarBinding
|
||||||
import org.yuzu.yuzu_emu.features.settings.model.Settings
|
import org.yuzu.yuzu_emu.features.settings.model.Settings
|
||||||
import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile
|
import org.yuzu.yuzu_emu.features.settings.utils.SettingsFile
|
||||||
import org.yuzu.yuzu_emu.fragments.IndeterminateProgressDialogFragment
|
import org.yuzu.yuzu_emu.fragments.IndeterminateProgressDialogFragment
|
||||||
import org.yuzu.yuzu_emu.fragments.LongMessageDialogFragment
|
|
||||||
import org.yuzu.yuzu_emu.fragments.MessageDialogFragment
|
import org.yuzu.yuzu_emu.fragments.MessageDialogFragment
|
||||||
import org.yuzu.yuzu_emu.model.GamesViewModel
|
import org.yuzu.yuzu_emu.model.GamesViewModel
|
||||||
import org.yuzu.yuzu_emu.model.HomeViewModel
|
import org.yuzu.yuzu_emu.model.HomeViewModel
|
||||||
|
@ -301,8 +300,8 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
||||||
fun processKey(result: Uri): Boolean {
|
fun processKey(result: Uri): Boolean {
|
||||||
if (FileUtil.getExtension(result) != "keys") {
|
if (FileUtil.getExtension(result) != "keys") {
|
||||||
MessageDialogFragment.newInstance(
|
MessageDialogFragment.newInstance(
|
||||||
R.string.reading_keys_failure,
|
titleId = R.string.reading_keys_failure,
|
||||||
R.string.install_prod_keys_failure_extension_description
|
descriptionId = R.string.install_prod_keys_failure_extension_description
|
||||||
).show(supportFragmentManager, MessageDialogFragment.TAG)
|
).show(supportFragmentManager, MessageDialogFragment.TAG)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -330,9 +329,9 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
MessageDialogFragment.newInstance(
|
MessageDialogFragment.newInstance(
|
||||||
R.string.invalid_keys_error,
|
titleId = R.string.invalid_keys_error,
|
||||||
R.string.install_keys_failure_description,
|
descriptionId = R.string.install_keys_failure_description,
|
||||||
R.string.dumping_keys_quickstart_link
|
helpLinkId = R.string.dumping_keys_quickstart_link
|
||||||
).show(supportFragmentManager, MessageDialogFragment.TAG)
|
).show(supportFragmentManager, MessageDialogFragment.TAG)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -370,8 +369,8 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
||||||
val filteredNumOfFiles = cacheFirmwareDir.list(filterNCA)?.size ?: -2
|
val filteredNumOfFiles = cacheFirmwareDir.list(filterNCA)?.size ?: -2
|
||||||
messageToShow = if (unfilteredNumOfFiles != filteredNumOfFiles) {
|
messageToShow = if (unfilteredNumOfFiles != filteredNumOfFiles) {
|
||||||
MessageDialogFragment.newInstance(
|
MessageDialogFragment.newInstance(
|
||||||
R.string.firmware_installed_failure,
|
titleId = R.string.firmware_installed_failure,
|
||||||
R.string.firmware_installed_failure_description
|
descriptionId = R.string.firmware_installed_failure_description
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
firmwarePath.deleteRecursively()
|
firmwarePath.deleteRecursively()
|
||||||
|
@ -401,8 +400,8 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
||||||
|
|
||||||
if (FileUtil.getExtension(result) != "bin") {
|
if (FileUtil.getExtension(result) != "bin") {
|
||||||
MessageDialogFragment.newInstance(
|
MessageDialogFragment.newInstance(
|
||||||
R.string.reading_keys_failure,
|
titleId = R.string.reading_keys_failure,
|
||||||
R.string.install_amiibo_keys_failure_extension_description
|
descriptionId = R.string.install_amiibo_keys_failure_extension_description
|
||||||
).show(supportFragmentManager, MessageDialogFragment.TAG)
|
).show(supportFragmentManager, MessageDialogFragment.TAG)
|
||||||
return@registerForActivityResult
|
return@registerForActivityResult
|
||||||
}
|
}
|
||||||
|
@ -428,9 +427,9 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
||||||
).show()
|
).show()
|
||||||
} else {
|
} else {
|
||||||
MessageDialogFragment.newInstance(
|
MessageDialogFragment.newInstance(
|
||||||
R.string.invalid_keys_error,
|
titleId = R.string.invalid_keys_error,
|
||||||
R.string.install_keys_failure_description,
|
descriptionId = R.string.install_keys_failure_description,
|
||||||
R.string.dumping_keys_quickstart_link
|
helpLinkId = R.string.dumping_keys_quickstart_link
|
||||||
).show(supportFragmentManager, MessageDialogFragment.TAG)
|
).show(supportFragmentManager, MessageDialogFragment.TAG)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -502,8 +501,6 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
||||||
var errorBaseGame = 0
|
var errorBaseGame = 0
|
||||||
var errorExtension = 0
|
var errorExtension = 0
|
||||||
var errorOther = 0
|
var errorOther = 0
|
||||||
var errorTotal = 0
|
|
||||||
lifecycleScope.launch {
|
|
||||||
documents.forEach {
|
documents.forEach {
|
||||||
when (NativeLibrary.installFileToNand(it.toString())) {
|
when (NativeLibrary.installFileToNand(it.toString())) {
|
||||||
NativeLibrary.InstallFileToNandResult.Success -> {
|
NativeLibrary.InstallFileToNandResult.Success -> {
|
||||||
|
@ -527,7 +524,7 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
withContext(Dispatchers.Main) {
|
|
||||||
val separator = System.getProperty("line.separator") ?: "\n"
|
val separator = System.getProperty("line.separator") ?: "\n"
|
||||||
val installResult = StringBuilder()
|
val installResult = StringBuilder()
|
||||||
if (installSuccess > 0) {
|
if (installSuccess > 0) {
|
||||||
|
@ -548,7 +545,7 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
||||||
)
|
)
|
||||||
installResult.append(separator)
|
installResult.append(separator)
|
||||||
}
|
}
|
||||||
errorTotal = errorBaseGame + errorExtension + errorOther
|
val errorTotal: Int = errorBaseGame + errorExtension + errorOther
|
||||||
if (errorTotal > 0) {
|
if (errorTotal > 0) {
|
||||||
installResult.append(separator)
|
installResult.append(separator)
|
||||||
installResult.append(
|
installResult.append(
|
||||||
|
@ -578,20 +575,17 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
|
||||||
)
|
)
|
||||||
installResult.append(separator)
|
installResult.append(separator)
|
||||||
}
|
}
|
||||||
LongMessageDialogFragment.newInstance(
|
return@newInstance MessageDialogFragment.newInstance(
|
||||||
R.string.install_game_content_failure,
|
titleId = R.string.install_game_content_failure,
|
||||||
installResult.toString().trim(),
|
descriptionString = installResult.toString().trim(),
|
||||||
R.string.install_game_content_help_link
|
helpLinkId = R.string.install_game_content_help_link
|
||||||
).show(supportFragmentManager, LongMessageDialogFragment.TAG)
|
)
|
||||||
} else {
|
} else {
|
||||||
LongMessageDialogFragment.newInstance(
|
return@newInstance MessageDialogFragment.newInstance(
|
||||||
R.string.install_game_content_success,
|
titleId = R.string.install_game_content_success,
|
||||||
installResult.toString().trim()
|
descriptionString = installResult.toString().trim()
|
||||||
).show(supportFragmentManager, LongMessageDialogFragment.TAG)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return@newInstance installSuccess + installOverwrite + errorTotal
|
|
||||||
}.show(supportFragmentManager, IndeterminateProgressDialogFragment.TAG)
|
}.show(supportFragmentManager, IndeterminateProgressDialogFragment.TAG)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue