[Scummvm-git-logs] scummvm master -> ca8b77e34162844865565dad48314b03e2f15324
antoniou79
noreply at scummvm.org
Sun Feb 26 18:10:47 UTC 2023
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
47e4f1e9f4 ANDROID: Do not set global save path as launch param
ca8b77e341 ANDROID: Create and Register default path for icons
Commit: 47e4f1e9f43e35a414836bec0cd8bd4fef9ce38c
https://github.com/scummvm/scummvm/commit/47e4f1e9f43e35a414836bec0cd8bd4fef9ce38c
Author: antoniou79 (a.antoniou79 at gmail.com)
Date: 2023-02-26T20:10:21+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: ca8b77e34162844865565dad48314b03e2f15324
https://github.com/scummvm/scummvm/commit/ca8b77e34162844865565dad48314b03e2f15324
Author: Antoniou Athanasios (a.antoniou79 at gmail.com)
Date: 2023-02-26T20:10:21+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