2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #11602 from t895/case-fix

android: Content install lowercase fix
This commit is contained in:
Charles Lombardo 2023-09-26 14:07:12 -04:00 committed by GitHub
commit 75180bdc9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 8 deletions

View file

@ -247,7 +247,12 @@ object NativeLibrary {
external fun setAppDirectory(directory: String) external fun setAppDirectory(directory: String)
external fun installFileToNand(filename: String): Int /**
* Installs a nsp or xci file to nand
* @param filename String representation of file uri
* @param extension Lowercase string representation of file extension without "."
*/
external fun installFileToNand(filename: String, extension: String): Int
external fun initializeGpuDriver( external fun initializeGpuDriver(
hookLibDir: String?, hookLibDir: String?,

View file

@ -515,7 +515,7 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
if (documents.isNotEmpty()) { if (documents.isNotEmpty()) {
IndeterminateProgressDialogFragment.newInstance( IndeterminateProgressDialogFragment.newInstance(
this@MainActivity, this@MainActivity,
R.string.install_game_content R.string.installing_game_content
) { ) {
var installSuccess = 0 var installSuccess = 0
var installOverwrite = 0 var installOverwrite = 0
@ -523,7 +523,12 @@ class MainActivity : AppCompatActivity(), ThemeProvider {
var errorExtension = 0 var errorExtension = 0
var errorOther = 0 var errorOther = 0
documents.forEach { documents.forEach {
when (NativeLibrary.installFileToNand(it.toString())) { when (
NativeLibrary.installFileToNand(
it.toString(),
FileUtil.getExtension(it)
)
) {
NativeLibrary.InstallFileToNandResult.Success -> { NativeLibrary.InstallFileToNandResult.Success -> {
installSuccess += 1 installSuccess += 1
} }

View file

@ -102,7 +102,7 @@ public:
m_native_window = native_window; m_native_window = native_window;
} }
int InstallFileToNand(std::string filename) { int InstallFileToNand(std::string filename, std::string file_extension) {
jconst copy_func = [](const FileSys::VirtualFile& src, const FileSys::VirtualFile& dest, jconst copy_func = [](const FileSys::VirtualFile& src, const FileSys::VirtualFile& dest,
std::size_t block_size) { std::size_t block_size) {
if (src == nullptr || dest == nullptr) { if (src == nullptr || dest == nullptr) {
@ -134,12 +134,12 @@ public:
m_system.GetFileSystemController().CreateFactories(*m_vfs); m_system.GetFileSystemController().CreateFactories(*m_vfs);
[[maybe_unused]] std::shared_ptr<FileSys::NSP> nsp; [[maybe_unused]] std::shared_ptr<FileSys::NSP> nsp;
if (filename.ends_with("nsp")) { if (file_extension == "nsp") {
nsp = std::make_shared<FileSys::NSP>(m_vfs->OpenFile(filename, FileSys::Mode::Read)); nsp = std::make_shared<FileSys::NSP>(m_vfs->OpenFile(filename, FileSys::Mode::Read));
if (nsp->IsExtractedType()) { if (nsp->IsExtractedType()) {
return InstallError; return InstallError;
} }
} else if (filename.ends_with("xci")) { } else if (file_extension == "xci") {
jconst xci = jconst xci =
std::make_shared<FileSys::XCI>(m_vfs->OpenFile(filename, FileSys::Mode::Read)); std::make_shared<FileSys::XCI>(m_vfs->OpenFile(filename, FileSys::Mode::Read));
nsp = xci->GetSecurePartitionNSP(); nsp = xci->GetSecurePartitionNSP();
@ -607,8 +607,10 @@ void Java_org_yuzu_yuzu_1emu_NativeLibrary_setAppDirectory(JNIEnv* env, jobject
} }
int Java_org_yuzu_yuzu_1emu_NativeLibrary_installFileToNand(JNIEnv* env, jobject instance, int Java_org_yuzu_yuzu_1emu_NativeLibrary_installFileToNand(JNIEnv* env, jobject instance,
[[maybe_unused]] jstring j_file) { jstring j_file,
return EmulationSession::GetInstance().InstallFileToNand(GetJString(env, j_file)); jstring j_file_extension) {
return EmulationSession::GetInstance().InstallFileToNand(GetJString(env, j_file),
GetJString(env, j_file_extension));
} }
void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_initializeGpuDriver(JNIEnv* env, jclass clazz, void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_initializeGpuDriver(JNIEnv* env, jclass clazz,

View file

@ -107,6 +107,7 @@
<string name="share_log_missing">No log file found</string> <string name="share_log_missing">No log file found</string>
<string name="install_game_content">Install game content</string> <string name="install_game_content">Install game content</string>
<string name="install_game_content_description">Install game updates or DLC</string> <string name="install_game_content_description">Install game updates or DLC</string>
<string name="installing_game_content">Installing content…</string>
<string name="install_game_content_failure">Error installing file(s) to NAND</string> <string name="install_game_content_failure">Error installing file(s) to NAND</string>
<string name="install_game_content_failure_description">Please ensure content(s) are valid and that the prod.keys file is installed.</string> <string name="install_game_content_failure_description">Please ensure content(s) are valid and that the prod.keys file is installed.</string>
<string name="install_game_content_failure_base">Installation of base games isn\'t permitted in order to avoid possible conflicts.</string> <string name="install_game_content_failure_base">Installation of base games isn\'t permitted in order to avoid possible conflicts.</string>