[Scummvm-git-logs] scummvm branch-2-7 -> 3db82010e42eee408503f336b1ec4b268a87cdf7
antoniou79
noreply at scummvm.org
Sun Feb 26 20:29:41 UTC 2023
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
376f978f57 BACKENDS: NETWORKING: Set pointer to nullptr when it's deleted
5483cd9a64 ANDROID: Allow to create a /saf node from path
283d67b185 ANDROID: Allow SAF non-existent node creation from path
c94bd8f3c3 ANDROID: Do not set global save path as launch param
3db82010e4 ANDROID: Create and Register default path for icons
Commit: 376f978f57710f4a890b400fe9418307f7755062
https://github.com/scummvm/scummvm/commit/376f978f57710f4a890b400fe9418307f7755062
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2023-02-26T21:46:29+02:00
Commit Message:
BACKENDS: NETWORKING: Set pointer to nullptr when it's deleted
This avoids a UAF when file failed to open.
Changed paths:
backends/networking/curl/sessionrequest.cpp
diff --git a/backends/networking/curl/sessionrequest.cpp b/backends/networking/curl/sessionrequest.cpp
index a0247480e68..0d5f145e433 100644
--- a/backends/networking/curl/sessionrequest.cpp
+++ b/backends/networking/curl/sessionrequest.cpp
@@ -58,6 +58,7 @@ void SessionRequest::openLocalFile(Common::String localFile) {
ErrorResponse error(this, false, true, "SessionRequestFile: unable to open file to download into", -1);
finishError(error);
delete _localFile;
+ _localFile = nullptr;
return;
}
Commit: 5483cd9a6460f4a4caf794a7ed65060aacbe4b6e
https://github.com/scummvm/scummvm/commit/5483cd9a6460f4a4caf794a7ed65060aacbe4b6e
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2023-02-26T21:46:40+02:00
Commit Message:
ANDROID: Allow to create a /saf node from path
This avoids errors when creating parent directories in DumpFile
This also allows the user to specify /saf path in browser to allow
browsing.
Changed paths:
backends/fs/android/android-fs-factory.cpp
backends/fs/android/android-posix-fs.cpp
backends/fs/android/android-saf-fs.cpp
backends/fs/android/android-saf-fs.h
diff --git a/backends/fs/android/android-fs-factory.cpp b/backends/fs/android/android-fs-factory.cpp
index e478b614548..af3dcab9416 100644
--- a/backends/fs/android/android-fs-factory.cpp
+++ b/backends/fs/android/android-fs-factory.cpp
@@ -53,10 +53,14 @@ AbstractFSNode *AndroidFilesystemFactory::makeFileNodePath(const Common::String
return makeRootFileNode();
}
- // No need to take SAF add mode here as it's called only for paths and we won't accept /saf path to make a new SAF
-
// If SAF works, it was a SAF URL
if (_withSAF) {
+ // Accept /saf as it can be used to create the tree in DumpFile
+ if (path == AddSAFFakeNode::SAF_ADD_FAKE_PATH) {
+ // Not a SAF mount point
+ return new AddSAFFakeNode(true);
+ }
+
AbstractFSNode *node = AndroidSAFFilesystemNode::makeFromPath(path);
if (node) {
return node;
@@ -90,7 +94,7 @@ void AndroidFilesystemFactory::getSAFTrees(AbstractFSList &list, bool allowSAFad
}
if (allowSAFadd) {
- list.push_back(new AddSAFFakeNode());
+ list.push_back(new AddSAFFakeNode(false));
}
}
diff --git a/backends/fs/android/android-posix-fs.cpp b/backends/fs/android/android-posix-fs.cpp
index f607c767d2b..2bc7fd4e7a9 100644
--- a/backends/fs/android/android-posix-fs.cpp
+++ b/backends/fs/android/android-posix-fs.cpp
@@ -30,13 +30,7 @@ AbstractFSNode *AndroidPOSIXFilesystemNode::makeNode() const {
}
AbstractFSNode *AndroidPOSIXFilesystemNode::makeNode(const Common::String &path) const {
- // If SAF works, it was a SAF URL
- AbstractFSNode *node = AndroidSAFFilesystemNode::makeFromPath(path);
- if (node) {
- return node;
- }
-
- return new AndroidPOSIXFilesystemNode(path, _config);
+ return AndroidFilesystemFactory::instance().makeFileNodePath(path);
}
#endif
diff --git a/backends/fs/android/android-saf-fs.cpp b/backends/fs/android/android-saf-fs.cpp
index b905386b5b0..0d7a0b227ac 100644
--- a/backends/fs/android/android-saf-fs.cpp
+++ b/backends/fs/android/android-saf-fs.cpp
@@ -586,6 +586,10 @@ AddSAFFakeNode::~AddSAFFakeNode() {
}
AbstractFSNode *AddSAFFakeNode::getChild(const Common::String &name) const {
+ if (_fromPath) {
+ // When starting from /saf try to get the tree node
+ return AndroidSAFFilesystemNode::makeFromPath(Common::String(AndroidSAFFilesystemNode::SAF_MOUNT_POINT) + name);
+ }
// We can't call getChild as it's protected
return nullptr;
}
@@ -596,6 +600,11 @@ AbstractFSNode *AddSAFFakeNode::getParent() const {
}
bool AddSAFFakeNode::exists() const {
+ if (_fromPath) {
+ // /saf always exists when created as a path
+ return true;
+ }
+
if (!_proxied) {
makeProxySAF();
}
@@ -608,6 +617,16 @@ bool AddSAFFakeNode::exists() const {
}
bool AddSAFFakeNode::getChildren(AbstractFSList &list, ListMode mode, bool hidden) const {
+ if (_fromPath) {
+ // When built from path, /saf lists all SAF node but never proposes to add one
+ if (mode == Common::FSNode::kListFilesOnly) {
+ // All directories
+ return true;
+ }
+ AndroidFilesystemFactory::instance().getSAFTrees(list, false);
+ return true;
+ }
+
if (!_proxied) {
makeProxySAF();
}
@@ -620,6 +639,10 @@ bool AddSAFFakeNode::getChildren(AbstractFSList &list, ListMode mode, bool hidde
}
Common::String AddSAFFakeNode::getPath() const {
+ if (_fromPath) {
+ return SAF_ADD_FAKE_PATH;
+ }
+
if (!_proxied) {
makeProxySAF();
}
@@ -632,6 +655,10 @@ Common::String AddSAFFakeNode::getPath() const {
}
bool AddSAFFakeNode::isReadable() const {
+ if (_fromPath) {
+ return true;
+ }
+
if (!_proxied) {
makeProxySAF();
}
@@ -644,6 +671,10 @@ bool AddSAFFakeNode::isReadable() const {
}
bool AddSAFFakeNode::isWritable() const {
+ if (_fromPath) {
+ return false;
+ }
+
if (!_proxied) {
makeProxySAF();
}
@@ -656,6 +687,8 @@ bool AddSAFFakeNode::isWritable() const {
}
void AddSAFFakeNode::makeProxySAF() const {
+ assert(!_fromPath);
+
if (_proxied) {
return;
}
diff --git a/backends/fs/android/android-saf-fs.h b/backends/fs/android/android-saf-fs.h
index f6ff2690515..931c9f6b282 100644
--- a/backends/fs/android/android-saf-fs.h
+++ b/backends/fs/android/android-saf-fs.h
@@ -162,7 +162,7 @@ protected:
public:
static const char SAF_ADD_FAKE_PATH[];
- AddSAFFakeNode() : _proxied(nullptr) { }
+ AddSAFFakeNode(bool fromPath) : _proxied(nullptr), _fromPath(fromPath) { }
~AddSAFFakeNode() override;
bool exists() const override;
@@ -187,6 +187,7 @@ public:
private:
void makeProxySAF() const;
+ bool _fromPath;
mutable AbstractFSNode *_proxied;
};
#endif
Commit: 283d67b185d40cba7bf0a34b236db924f0a55475
https://github.com/scummvm/scummvm/commit/283d67b185d40cba7bf0a34b236db924f0a55475
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2023-02-26T21:46:50+02:00
Commit Message:
ANDROID: Allow SAF non-existent node creation from path
This is used by DumpFile.
As in all other implementations, parent node is expected to exist.
Changed paths:
backends/fs/android/android-saf-fs.cpp
diff --git a/backends/fs/android/android-saf-fs.cpp b/backends/fs/android/android-saf-fs.cpp
index 0d7a0b227ac..cfa2510794a 100644
--- a/backends/fs/android/android-saf-fs.cpp
+++ b/backends/fs/android/android-saf-fs.cpp
@@ -167,17 +167,64 @@ AndroidSAFFilesystemNode *AndroidSAFFilesystemNode::makeFromPath(const Common::S
return nullptr;
}
- if (!node) {
+ if (node) {
+ AndroidSAFFilesystemNode *ret = new AndroidSAFFilesystemNode(safTree, node);
+
+ env->DeleteLocalRef(node);
+ env->DeleteLocalRef(safTree);
+
+ return ret;
+ }
+
+ // Node doesn't exist: we will try to make a node from the parent and
+ // if it works we will create a non-existent node
+
+ pos = realPath.findLastOf('/');
+ if (pos == Common::String::npos || pos == 0) {
+ // No / in path or at root, no parent and we have a tree: it's all good
+ if (pos == 0) {
+ realPath = realPath.substr(1);
+ }
+ AndroidSAFFilesystemNode *parent = makeFromTree(safTree);
+ AndroidSAFFilesystemNode *ret = static_cast<AndroidSAFFilesystemNode *>(parent->getChild(realPath));
+ delete parent;
+
+ // safTree has already been released by makeFromTree
+ return ret;
+ }
+
+ Common::String baseName(realPath.substr(pos + 1));
+ realPath.erase(pos);
+
+ pathObj = env->NewStringUTF(realPath.c_str());
+
+ node = env->CallObjectMethod(safTree, _MID_pathToNode, pathObj);
+
+ env->DeleteLocalRef(pathObj);
+
+ if (env->ExceptionCheck()) {
+ LOGE("SAFFSTree::pathToNode failed");
+
+ env->ExceptionDescribe();
+ env->ExceptionClear();
+
env->DeleteLocalRef(safTree);
return nullptr;
}
- AndroidSAFFilesystemNode *ret = new AndroidSAFFilesystemNode(safTree, node);
+ if (node) {
+ AndroidSAFFilesystemNode *parent = new AndroidSAFFilesystemNode(safTree, node);
+ env->DeleteLocalRef(node);
+ env->DeleteLocalRef(safTree);
- env->DeleteLocalRef(node);
- env->DeleteLocalRef(safTree);
+ AndroidSAFFilesystemNode *ret = static_cast<AndroidSAFFilesystemNode *>(parent->getChild(baseName));
+ delete parent;
- return ret;
+ return ret;
+ }
+
+ env->DeleteLocalRef(safTree);
+ return nullptr;
}
AndroidSAFFilesystemNode *AndroidSAFFilesystemNode::makeFromTree(jobject safTree) {
Commit: c94bd8f3c378c47d3fdfc062ac60af419da9c527
https://github.com/scummvm/scummvm/commit/c94bd8f3c378c47d3fdfc062ac60af419da9c527
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2023-02-26T21:47:02+02:00
Commit Message:
ANDROID: Do not set global save path as launch param
Changed paths:
backends/platform/android/android.cpp
backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index 4958412bbcf..98320cbda46 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -450,19 +450,8 @@ void OSystem_Android::initBackend() {
ConfMan.setInt("gui_scale", 125); // "Large" (see gui/options.cpp and guiBaseValues[])
}
- // BUG: "transient" ConfMan settings get nuked by the options
- // screen. Passing the savepath in this way makes it stick
- // (via ConfMan.registerDefault() which is called from DefaultSaveFileManager constructor (backends/saves/default/default-saves.cpp))
- // Note: The aforementioned bug is probably the one reported here:
- // https://bugs.scummvm.org/ticket/3712
- // and maybe here:
- // https://bugs.scummvm.org/ticket/7389
- // However, we do NOT set the savepath key explicitly for ConfMan
- // and thus the savepath will only be persisted as "default" config
- // for the rest of the app session (until exit).
- // It will NOT be reflected on the GUI, if it's not set explicitly by the user there
- // TODO Why do we need it not shown on the GUI though?
- // Btw, this is a ScummVM thing, the "defaults" do not show they values on our GUI)
+
+ ConfMan.registerDefault("savepath", ConfMan.get("path") + "/saves");
_savefileManager = new DefaultSaveFileManager(ConfMan.get("savepath"));
// TODO remove the debug message eventually
LOGD("Setting DefaultSaveFileManager path to: %s", ConfMan.get("savepath").c_str());
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
index a8b99d95db5..19f9f6ff0b8 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
@@ -79,9 +79,7 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
private File _configScummvmFile;
private File _actualScummVMDataDir;
private File _possibleExternalScummVMDir;
- private File _usingScummVMSavesDir;
boolean _externalPathAvailableForReadAccess;
-// private File _usingLogFile;
// SAF related
public final static int REQUEST_SAF = 50000;
@@ -948,16 +946,13 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
// Start ScummVM
// Log.d(ScummVM.LOG_TAG, "CONFIG: " + _configScummvmFile.getPath());
// Log.d(ScummVM.LOG_TAG, "PATH: " + _actualScummVMDataDir.getPath());
-// Log.d(ScummVM.LOG_TAG, "LOG: " + _usingLogFile.getPath());
-// Log.d(ScummVM.LOG_TAG, "SAVEPATH: " + _usingScummVMSavesDir.getPath());
// TODO log file setting via "--logfile=" + _usingLogFile.getPath() causes crash
// probably because this option is specific to SDL_BACKEND (see: base/commandLine.cpp)
_scummvm.setArgs(new String[]{
"ScummVM",
"--config=" + _configScummvmFile.getPath(),
- "--path=" + _actualScummVMDataDir.getPath(),
- "--savepath=" + _usingScummVMSavesDir.getPath()
+ "--path=" + _actualScummVMDataDir.getPath()
});
Log.d(ScummVM.LOG_TAG, "Hover available: " + _hoverAvailable);
@@ -1400,21 +1395,7 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
// to avoid issues with unavailable shared / external storage and to be (mostly) compatible with what the older versions did
// WARNING: The returned path may change over time if the calling app is moved to an adopted storage device, so only relative paths should be persisted.
_actualScummVMDataDir = getFilesDir();
- // Checking for null only makes sense if we were using external storage
-// if (_actualScummVMDataDir == null || !_actualScummVMDataDir.canRead()) {
-// new AlertDialog.Builder(this)
-// .setTitle(R.string.no_external_files_dir_access_title)
-// .setIcon(android.R.drawable.ic_dialog_alert)
-// .setMessage(R.string.no_external_files_dir_access)
-// .setNegativeButton(R.string.quit,
-// new DialogInterface.OnClickListener() {
-// public void onClick(DialogInterface dialog, int which) {
-// finish();
-// }
-// })
-// .show();
-// return false;
-// }
+ // Checking for null _actualScummVMDataDir only makes sense if we were using external storage
Log.d(ScummVM.LOG_TAG, "Base ScummVM data folder is: " + _actualScummVMDataDir.getPath());
String smallNodeDesc;
@@ -1430,77 +1411,11 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
}
}
-// File internalScummVMLogsDir = new File(_actualScummVMDataDir, ".cache/scummvm/logs");
-// if (!internalScummVMLogsDir.exists() && internalScummVMLogsDir.mkdirs()) {
-// Log.d(ScummVM.LOG_TAG, "Created ScummVM Logs path: " + internalScummVMLogsDir.getPath());
-// } else if (internalScummVMLogsDir.isDirectory()) {
-// Log.d(ScummVM.LOG_TAG, "ScummVM Logs path already exists: " + internalScummVMLogsDir.getPath());
-// } else {
-// Log.e(ScummVM.LOG_TAG, "Could not create folder for ScummVM Logs path: " + internalScummVMLogsDir.getPath());
-// new AlertDialog.Builder(this)
-// .setTitle(R.string.no_log_file_title)
-// .setIcon(android.R.drawable.ic_dialog_alert)
-// .setMessage(R.string.no_log_file)
-// .setNegativeButton(R.string.quit,
-// new DialogInterface.OnClickListener() {
-// public void onClick(DialogInterface dialog, int which) {
-// finish();
-// }
-// })
-// .show();
-// return false;
-// }
-//
-// _usingLogFile = new File(internalScummVMLogsDir, "scummvm.log");
-// try {
-// if (_usingLogFile.exists() || !_usingLogFile.createNewFile()) {
-// Log.d(ScummVM.LOG_TAG, "ScummVM Log file already exists!");
-// Log.d(ScummVM.LOG_TAG, "Existing ScummVM Log: " + _usingLogFile.getPath());
-// } else {
-// Log.d(ScummVM.LOG_TAG, "An empty ScummVM log file was created!");
-// Log.d(ScummVM.LOG_TAG, "New ScummVM Log: " + _usingLogFile.getPath());
-// }
-// } catch (Exception e) {
-// e.printStackTrace();
-// new AlertDialog.Builder(this)
-// .setTitle(R.string.no_log_file_title)
-// .setIcon(android.R.drawable.ic_dialog_alert)
-// .setMessage(R.string.no_log_file)
-// .setNegativeButton(R.string.quit,
-// new DialogInterface.OnClickListener() {
-// public void onClick(DialogInterface dialog, int which) {
-// finish();
-// }
-// })
-// .show();
-// return false;
-// }
-
- File internalScummVMConfigDir = new File(_actualScummVMDataDir, ".config/scummvm");
- if (!internalScummVMConfigDir.exists() && internalScummVMConfigDir.mkdirs()) {
- Log.d(ScummVM.LOG_TAG, "Created ScummVM Config path: " + internalScummVMConfigDir.getPath());
- } else if (internalScummVMConfigDir.isDirectory()) {
- Log.d(ScummVM.LOG_TAG, "ScummVM Config path already exists: " + internalScummVMConfigDir.getPath());
- } else {
- Log.e(ScummVM.LOG_TAG, "Could not create folder for ScummVM Config path: " + internalScummVMConfigDir.getPath());
- new AlertDialog.Builder(this)
- .setTitle(R.string.no_config_file_title)
- .setIcon(android.R.drawable.ic_dialog_alert)
- .setMessage(R.string.no_config_file)
- .setNegativeButton(R.string.quit,
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- finish();
- }
- })
- .show();
- return false;
- }
-
LinkedHashMap<String, File> candidateOldLocationsOfScummVMConfigMap = new LinkedHashMap<>();
- // Note: The "missing" case below for: (scummvm.ini)) (SDL port - A) is checked above; it is the same path we store the config file for 2.3+
+ // Note: The "missing" case below for: (scummvm.ini)) (SDL port - A) is checked above;
+ // it is the same path we store the config file for 2.3+
// SDL port was officially on the Play Store for versions 1.9+ up until and including 2.0)
- // Using LinkedHashMap because the order of searching is important
+ // Using LinkedHashMap because the order of searching is important.
// We want to re-use the more recent ScummVM old version too
// TODO try getDir too without a path? just "." ??
candidateOldLocationsOfScummVMConfigMap.put("(scummvm.ini) (SDL port - B)", new File(_actualScummVMDataDir, "../.config/scummvm/scummvm.ini"));
@@ -1562,10 +1477,9 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
boolean existingConfigInScummVMDataDirReplacedOnce = false; // patch for 2.2.1 Beta1 purposes
// NOTE: our config file scummvm.ini is created directly inside the ScummVM internal app path
- // this is probably due to a mistake (?), since we do create a config path for it above
- // ( in File internalScummVMConfigDir , the sub-path ".config/scummvm")
- // However, this is harmless, so we can keep it this way.
- // Or we could change it in a future version.
+ // It is more user friendly to keep it this way (rather than put it in a subpath ".config/scummvm",
+ // since it can be directly browsable using the ScummVM's LAN server mode,
+ // and looking in the root of the internal app folder.
// Keep in mind that changing the scummvm.ini config file location would require at the very least:
// - Moving the old scummvm.ini (if upgrading) to the new location and deleting it from the old one
// - Updating the ScummVM documentation about the new location
@@ -1582,7 +1496,6 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
if (tmpOldVersionFound.compareTo(maxOldVersionFound) > 0) {
maxOldVersionFound = tmpOldVersionFound;
existingVersionFoundInScummVMDataDir = tmpOldVersionFound;
- //scummVMConfigHandled = false; // invalidate the handled flag
}
} else {
Log.d(ScummVM.LOG_TAG, "Could not find info on existing ScummVM version. Unsupported or corrupt file?");
@@ -1725,20 +1638,13 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
// or external storage not always being available (but then eg. a save file on the storage should be correctly shown as not available)
// or maybe among Android OS versions the same external storage could be mounted to a (somewhat) different path?
// However, it seems unavoidable when user has set paths explicitly (ie not using the defaults)
- // We always set the default save path as a launch parameter
//
// By default choose to store savegames on app's internal storage, which is always available
//
File defaultScummVMSavesPath = new File(_actualScummVMDataDir, "saves");
- // By default use this as the saves path
- _usingScummVMSavesDir = new File(defaultScummVMSavesPath.getPath());
if (defaultScummVMSavesPath.exists() && defaultScummVMSavesPath.isDirectory()) {
- try {
- Log.d(ScummVM.LOG_TAG, "ScummVM default saves path already exists: " + defaultScummVMSavesPath.getPath());
- } catch (Exception e) {
- Log.d(ScummVM.LOG_TAG, "ScummVM default saves path exception CAUGHT!");
- }
+ Log.d(ScummVM.LOG_TAG, "ScummVM default saves path already exists: " + defaultScummVMSavesPath.getPath());
} else if (!defaultScummVMSavesPath.exists() && defaultScummVMSavesPath.mkdirs()) {
Log.d(ScummVM.LOG_TAG, "Created ScummVM default saves path: " + defaultScummVMSavesPath.getPath());
} else {
@@ -1939,50 +1845,6 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
}
}
}
-
- File persistentGlobalSavePath = null;
- if (_configScummvmFile.exists() && _configScummvmFile.isFile()) {
- Log.d(ScummVM.LOG_TAG, "Looking into config file for save path: " + _configScummvmFile.getPath());
- String persistentGlobalSavePathStr = getSavepathInfoFromScummvmConfiguration(_configScummvmFile.getPath());
- if (!TextUtils.isEmpty(persistentGlobalSavePathStr) && !TextUtils.isEmpty(persistentGlobalSavePathStr.trim()) ) {
- Log.d(ScummVM.LOG_TAG, "Found explicit save path: " + persistentGlobalSavePathStr);
- persistentGlobalSavePath = new File(persistentGlobalSavePathStr);
- if (persistentGlobalSavePath.exists() && persistentGlobalSavePath.isDirectory() && persistentGlobalSavePath.listFiles() != null) {
- try {
- Log.d(ScummVM.LOG_TAG, "ScummVM explicit saves path folder exists and it is list-able");
- } catch (Exception e) {
- persistentGlobalSavePath = null;
- Log.e(ScummVM.LOG_TAG, "ScummVM explicit saves path exception CAUGHT!");
- }
- } else {
- // We won't bother creating it, it's not in our scope to do that (and it would probably result in potential permission issues)
- Log.e(ScummVM.LOG_TAG, "Could not access explicit save folder for ScummVM: " + persistentGlobalSavePath.getPath());
- persistentGlobalSavePath = null;
- // We should *not* quit or return here,
- // TODO But, how do we override this explicit set path? Do we leave it to the user to reset it?
- new AlertDialog.Builder(this)
- .setTitle(R.string.no_save_path_title)
- .setIcon(android.R.drawable.ic_dialog_alert)
- .setMessage(R.string.bad_explicit_save_path_configured)
- .setPositiveButton(R.string.ok,
- new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
-
- }
- })
- .show();
- }
- } else {
- Log.d(ScummVM.LOG_TAG, "Could not find explicit save path info in ScummVM's config file");
- }
- }
-
- if (persistentGlobalSavePath != null) {
- // Use the persistent savepath
- _usingScummVMSavesDir = new File(persistentGlobalSavePath.getPath());
- }
- Log.d(ScummVM.LOG_TAG, "Resulting save path is: " + _usingScummVMSavesDir.getPath());
-
return true;
}
Commit: 3db82010e42eee408503f336b1ec4b268a87cdf7
https://github.com/scummvm/scummvm/commit/3db82010e42eee408503f336b1ec4b268a87cdf7
Author: Antoniou Athanasios (a.antoniou79 at gmail.com)
Date: 2023-02-26T21:47:10+02:00
Commit Message:
ANDROID: Create and Register default path for icons
Changed paths:
backends/platform/android/android.cpp
backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
dists/android/res/values/strings.xml
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index 98320cbda46..a06a5ca224f 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -456,6 +456,11 @@ void OSystem_Android::initBackend() {
// TODO remove the debug message eventually
LOGD("Setting DefaultSaveFileManager path to: %s", ConfMan.get("savepath").c_str());
+
+ ConfMan.registerDefault("iconspath", ConfMan.get("path") + "/icons");
+ // TODO remove the debug message eventually
+ LOGD("Setting Default Icons and Shaders path to: %s", ConfMan.get("iconspath").c_str());
+
_timerManager = new DefaultTimerManager();
_event_queue_lock = new Common::Mutex();
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
index 19f9f6ff0b8..3f0e72461f2 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
@@ -1845,6 +1845,29 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
}
}
}
+
+ // Also create the default directory for icons and shaders
+ File defaultScummVMIconsPath = new File(_actualScummVMDataDir, "icons");
+
+ if (defaultScummVMIconsPath.exists() && defaultScummVMIconsPath.isDirectory()) {
+ Log.d(ScummVM.LOG_TAG, "ScummVM default icons/shaders path already exists: " + defaultScummVMIconsPath.getPath());
+ } else if (!defaultScummVMIconsPath.exists() && defaultScummVMIconsPath.mkdirs()) {
+ Log.d(ScummVM.LOG_TAG, "Created ScummVM default icons/shaders path: " + defaultScummVMIconsPath.getPath());
+ } else {
+ Log.e(ScummVM.LOG_TAG, "Could not create folder for ScummVM default icons/shaders path: " + defaultScummVMIconsPath.getPath());
+ new AlertDialog.Builder(this)
+ .setTitle(R.string.no_icons_path_title)
+ .setIcon(android.R.drawable.ic_dialog_alert)
+ .setMessage(R.string.no_icons_path_configured)
+ .setNegativeButton(R.string.quit,
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ finish();
+ }
+ })
+ .show();
+ return false;
+ }
return true;
}
diff --git a/dists/android/res/values/strings.xml b/dists/android/res/values/strings.xml
index 08eb96d360a..b0e642f1aea 100644
--- a/dists/android/res/values/strings.xml
+++ b/dists/android/res/values/strings.xml
@@ -25,6 +25,8 @@
<string name="no_config_file">Unable to read ScummVM config file or create a new one!</string>
<string name="no_save_path_title">Save Path Error</string>
<string name="no_save_path_configured">Unable to create or access default save path!</string>
+ <string name="no_icons_path_title">Icons Path Error</string>
+ <string name="no_icons_path_configured">Unable to create or access default icons and shaders path!</string>
<string name="bad_explicit_save_path_configured">Unable to access the globally set save path! Please revert to default from ScummVM Options</string>
<!-- <string name="no_plugins_title">No plugins found</string> -->
<!-- <string name="no_plugins_found">ScummVM requires at least one <i>game
More information about the Scummvm-git-logs
mailing list