[Scummvm-git-logs] scummvm master -> 6bbcd95c101cb602640ff6ba018b54ac6184db41

lephilousophe noreply at scummvm.org
Sat Mar 11 17:22:53 UTC 2023


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
bc89781445 ANDROID: Use SAF only with Nougat
528378a560 ANDROID: Fix RequiresApi annotations
6bbcd95c10 GRAPHICS: Handle cases where glGetString returns a nullptr


Commit: bc89781445c0d3d9a8c45e6af7817395727f08c5
    https://github.com/scummvm/scummvm/commit/bc89781445c0d3d9a8c45e6af7817395727f08c5
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2023-03-11T18:19:54+01:00

Commit Message:
ANDROID: Use SAF only with Nougat

Lollipop doesn't have some functions like removeDocument and isTreeUri.
SAF is slower and doesn't need to be enabled on Lollipop devices.

Changed paths:
    backends/platform/android/android.cpp
    backends/platform/android/org/scummvm/scummvm/SAFFSTree.java
    backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java


diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index 09a6270c32f..5e38b82a125 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -194,7 +194,7 @@ OSystem_Android::OSystem_Android(int audio_sample_rate, int audio_buffer_size) :
 	LOGI("SDK Version: %d", sdkVersion);
 
 	AndroidFilesystemFactory &fsFactory = AndroidFilesystemFactory::instance();
-	if (sdkVersion >= 21) {
+	if (sdkVersion >= 24) {
 		fsFactory.initSAF();
 	}
 	_fsFactory = &fsFactory;
diff --git a/backends/platform/android/org/scummvm/scummvm/SAFFSTree.java b/backends/platform/android/org/scummvm/scummvm/SAFFSTree.java
index 1a8645003b7..e9f9ffaed8f 100644
--- a/backends/platform/android/org/scummvm/scummvm/SAFFSTree.java
+++ b/backends/platform/android/org/scummvm/scummvm/SAFFSTree.java
@@ -26,7 +26,7 @@ import androidx.annotation.RequiresApi;
 /**
  * SAF primitives for C++ FSNode
  */
- at RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
+ at RequiresApi(api = Build.VERSION_CODES.N)
 public class SAFFSTree {
 	private static HashMap<String, SAFFSTree> _trees;
 
@@ -68,6 +68,7 @@ public class SAFFSTree {
 		return _trees.get(name);
 	}
 
+	@RequiresApi(api = 0)
 	public static void clearCaches() {
 		if (_trees == null) {
 			return;
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
index 4ecdd043558..63fcca94502 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
@@ -823,6 +823,7 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
 		}
 
 		@Override
+		@RequiresApi(api = Build.VERSION_CODES.N)
 		protected SAFFSTree getNewSAFTree(boolean folder, boolean write, String initialURI, String prompt) {
 			Uri initialURI_ = Uri.parse(initialURI);
 			Uri uri = selectWithNativeUI(folder, write, initialURI_, prompt);
@@ -834,11 +835,13 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
 		}
 
 		@Override
+		@RequiresApi(api = Build.VERSION_CODES.N)
 		protected SAFFSTree[] getSAFTrees() {
 			return SAFFSTree.getTrees(ScummVMActivity.this);
 		}
 
 		@Override
+		@RequiresApi(api = Build.VERSION_CODES.N)
 		protected SAFFSTree findSAFTree(String name) {
 			return SAFFSTree.findTree(ScummVMActivity.this, name);
 		}
@@ -1993,6 +1996,7 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
 	// Furthermore, on Android 11 (API level 30) and higher, you cannot use the ACTION_OPEN_DOCUMENT_TREE intent action to request that the user select individual files from the following directories:
 	// - The Android/data/ directory and all subdirectories.
 	// - The Android/obb/ directory and all subdirectories.
+	@RequiresApi(api = Build.VERSION_CODES.N)
 	public Uri selectWithNativeUI(boolean folder, boolean write, Uri initialURI, String prompt) {
 		// Choose a directory using the system's folder picker.
 		Intent intent;


Commit: 528378a560561b350e625c8443972e261485d40e
    https://github.com/scummvm/scummvm/commit/528378a560561b350e625c8443972e261485d40e
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2023-03-11T18:19:54+01:00

Commit Message:
ANDROID: Fix RequiresApi annotations

These have been checked with Android linter and are not necessary.
setMarginEnd is only available starting with L_MR1 and is not useful.

Changed paths:
    backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
    dists/android/build.gradle


diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
index 63fcca94502..56bf41b8aed 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java
@@ -852,7 +852,6 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
 	private MouseHelper _mouseHelper;
 	private Thread _scummvm_thread;
 
-	@RequiresApi(api = Build.VERSION_CODES.KITKAT)
 	@Override
 	public void onCreate(Bundle savedInstanceState) {
 		super.onCreate(savedInstanceState);
@@ -876,8 +875,7 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
 
 		LinearLayout buttonLayout = new LinearLayout(this);
 		buttonLayout.setOrientation(LinearLayout.HORIZONTAL);
-		FrameLayout.LayoutParams buttonLayoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.TOP | Gravity.END);
-		buttonLayoutParams.setMarginEnd(5);
+		FrameLayout.LayoutParams buttonLayoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.TOP | Gravity.RIGHT);
 		buttonLayoutParams.topMargin = 5;
 		buttonLayoutParams.rightMargin = 5;
 		_videoLayout.addView(buttonLayout, buttonLayoutParams);
@@ -1270,7 +1268,6 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
 	}
 
 	// Auxiliary function to overwrite a file (used for overwriting the scummvm.ini file with an existing other one)
-	@RequiresApi(api = Build.VERSION_CODES.KITKAT)
 	private static void copyFileUsingStream(File source, File dest) throws IOException {
 		try (InputStream is = new FileInputStream(source); OutputStream os = new FileOutputStream(dest)) {
 			copyStreamToStream(is, os);
@@ -1311,7 +1308,6 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
 		return result;
 	}
 
-	@RequiresApi(api = Build.VERSION_CODES.KITKAT)
 	private static String getVersionInfoFromScummvmConfiguration(String fullIniFilePath) {
 		try (BufferedReader bufferedReader = new BufferedReader(new FileReader(fullIniFilePath))) {
 			Map<String, Properties> parsedIniMap = parseINI(bufferedReader);
@@ -1326,7 +1322,6 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
 		return "";
 	}
 
-	@RequiresApi(api = Build.VERSION_CODES.KITKAT)
 	private static String getSavepathInfoFromScummvmConfiguration(String fullIniFilePath) {
 		try (BufferedReader bufferedReader = new BufferedReader(new FileReader(fullIniFilePath))) {
 			Map<String, Properties> parsedIniMap = parseINI(bufferedReader);
@@ -1341,7 +1336,6 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
 		return "";
 	}
 
-	@RequiresApi(api = Build.VERSION_CODES.KITKAT)
 	private boolean seekAndInitScummvmConfiguration() {
 
 		// https://developer.android.com/reference/android/content/Context#getExternalFilesDir(java.lang.String)
@@ -1920,7 +1914,6 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
 	// - We don't need to copy (sub)folders
 	// - We copy all the files from our assets (not a subset of them)
 	// Otherwise we would probably need to create a specifically named zip file with the selection of files we'd need to extract to the internal memory
-	@RequiresApi(api = Build.VERSION_CODES.KITKAT)
 	private void copyAssetsToInternalMemory(boolean sideUpgrade) {
 		// sideUpgrade is set to true, if we upgrade to the same version -- just check for the files existence before copying
 		if (_actualScummVMDataDir != null) {
diff --git a/dists/android/build.gradle b/dists/android/build.gradle
index f6cfcdc26b9..2c4ec63f7bb 100644
--- a/dists/android/build.gradle
+++ b/dists/android/build.gradle
@@ -35,7 +35,7 @@ android {
 
         setProperty("archivesBaseName", "ScummVM")
 
-        minSdkVersion 19
+        minSdkVersion 16
         targetSdkVersion 33
 
         versionName "2.8.0"


Commit: 6bbcd95c101cb602640ff6ba018b54ac6184db41
    https://github.com/scummvm/scummvm/commit/6bbcd95c101cb602640ff6ba018b54ac6184db41
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2023-03-11T18:19:54+01:00

Commit Message:
GRAPHICS: Handle cases where glGetString returns a nullptr

Changed paths:
    graphics/opengl/context.cpp


diff --git a/graphics/opengl/context.cpp b/graphics/opengl/context.cpp
index da9e36911ee..cde9011a241 100644
--- a/graphics/opengl/context.cpp
+++ b/graphics/opengl/context.cpp
@@ -104,7 +104,10 @@ void Context::initialize(ContextType contextType) {
 
 	const char *verString = (const char *)glGetString(GL_VERSION);
 
-	if (type == kContextGL) {
+	if (!verString) {
+		majorVersion = minorVersion = 0;
+		warning("Could not parse fetch GL_VERSION: %d", glGetError());
+	} else if (type == kContextGL) {
 		// OpenGL version number is either of the form major.minor or major.minor.release,
 		// where the numbers all have one or more digits
 		if (sscanf(verString, "%d.%d", &majorVersion, &minorVersion) != 2) {
@@ -141,6 +144,9 @@ void Context::initialize(ContextType contextType) {
 	glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&maxTextureSize);
 
 	const char *extString = (const char *)glGetString(GL_EXTENSIONS);
+	if (!extString) {
+		extString = "";
+	}
 
 	bool ARBShaderObjects = false;
 	bool ARBShadingLanguage100 = false;




More information about the Scummvm-git-logs mailing list