[Scummvm-git-logs] scummvm master -> 9e35ce0e52909068c7d5832d0215cae9bdf870a1
antoniou79
a.antoniou79 at gmail.com
Fri Sep 18 12:12:27 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
9e35ce0e52 ANDROID: Add internal app path to SearchSet
Commit: 9e35ce0e52909068c7d5832d0215cae9bdf870a1
https://github.com/scummvm/scummvm/commit/9e35ce0e52909068c7d5832d0215cae9bdf870a1
Author: antoniou (a.antoniou79 at gmail.com)
Date: 2020-09-18T15:12:16+03:00
Commit Message:
ANDROID: Add internal app path to SearchSet
Also have it with higher priority than the Android's assets structure which is too slow
Fixes a bug whereby a large font.dat file was very slow to be accessed during launch (for the modern themes), due to it being accessed from the Assets rather than the file system
Changed paths:
backends/platform/android/jni-android.cpp
backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
diff --git a/backends/platform/android/jni-android.cpp b/backends/platform/android/jni-android.cpp
index f9bbb6f880..c5c98df91e 100644
--- a/backends/platform/android/jni-android.cpp
+++ b/backends/platform/android/jni-android.cpp
@@ -378,11 +378,15 @@ void JNI::showKeyboardControl(bool enable) {
}
}
+// The following adds assets folder to search set.
+// However searching and retrieving from "assets" on Android this is slow
+// so we also make sure to add the "path" directory, with a higher priority
+// This is done via a call to ScummVMActivity's (java) getSysArchives
void JNI::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
JNIEnv *env = JNI::getEnv();
- s.add("ASSET", _asset_archive, priority, false);
-
+ // get any additional specified paths (from ScummVMActivity code)
+ // Insert them with "priority" priority.
jobjectArray array =
(jobjectArray)env->CallObjectMethod(_jobj, _MID_getSysArchives);
@@ -407,6 +411,15 @@ void JNI::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
env->DeleteLocalRef(path_obj);
}
+
+ // add the internal asset (android's structure) with a lower priority,
+ // since:
+ // 1. It is very slow in accessing large files (eg our growing fonts.dat)
+ // 2. we extract the asset contents anyway to the internal app path
+ // 3. we pass the internal app path in the process above (via _MID_getSysArchives)
+ // However, we keep android APK's "assets" as a fall back, in case something went wrong with the extraction process
+ // and since we had the code anyway
+ s.add("ASSET", _asset_archive, priority - 1, false);
}
char *JNI::convertEncoding(const char *to, const char *from, const char *string, size_t length) {
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
index 4632b85659..4135f73ea7 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
@@ -181,7 +181,8 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
@Override
protected String[] getSysArchives() {
- return new String[0];
+ Log.d(ScummVM.LOG_TAG, "Adding to Search Archive: " + _actualScummVMDataDir.getPath());
+ return new String[] {_actualScummVMDataDir.getPath()};
}
@Override
More information about the Scummvm-git-logs
mailing list