[Scummvm-git-logs] scummvm master -> acb6703e3273d1734ef12bd5117c329157cc1627

lephilousophe noreply at scummvm.org
Sun May 25 09:34:01 UTC 2025


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

Summary:
dbb42e37e2 ENGINES: Allow inlining of PauseToken constructors
acb6703e32 ANDROID: Remove static PauseToken


Commit: dbb42e37e214fbf83d384917dd1861e7f3236b49
    https://github.com/scummvm/scummvm/commit/dbb42e37e214fbf83d384917dd1861e7f3236b49
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-05-25T11:33:17+02:00

Commit Message:
ENGINES: Allow inlining of PauseToken constructors

Changed paths:
    engines/engine.cpp
    engines/engine.h


diff --git a/engines/engine.cpp b/engines/engine.cpp
index b9952eae088..9ca49844961 100644
--- a/engines/engine.cpp
+++ b/engines/engine.cpp
@@ -1026,10 +1026,6 @@ GUI::Debugger *Engine::getOrCreateDebugger() {
 	return _debugger;
 }
 
-PauseToken::PauseToken() : _engine(nullptr) {}
-
-PauseToken::PauseToken(Engine *engine) : _engine(engine) {}
-
 void PauseToken::operator=(const PauseToken &t2) {
 	if (_engine) {
 		error("Tried to assign to an already busy PauseToken");
diff --git a/engines/engine.h b/engines/engine.h
index 3dbf4865de7..e75c5951803 100644
--- a/engines/engine.h
+++ b/engines/engine.h
@@ -102,7 +102,7 @@ class Engine;
 */
 class PauseToken {
 public:
-	PauseToken();
+	constexpr PauseToken() : _engine(nullptr) {}
 	/**
 	 * Construct a pause token.
 	 */
@@ -132,7 +132,7 @@ public:
 	bool isActive() const { return _engine != nullptr; }
 
 private:
-	PauseToken(Engine *);
+	constexpr PauseToken(Engine *engine) : _engine(engine) {}
 
 	Engine *_engine;
 	/**


Commit: acb6703e3273d1734ef12bd5117c329157cc1627
    https://github.com/scummvm/scummvm/commit/acb6703e3273d1734ef12bd5117c329157cc1627
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-05-25T11:33:21+02:00

Commit Message:
ANDROID: Remove static PauseToken

This forced us to have a global destructor.
This removes the only one warning present in Android backend code.

Changed paths:
    backends/platform/android/android.cpp
    backends/platform/android/android.h
    backends/platform/android/jni-android.cpp
    backends/platform/android/jni-android.h


diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index 506492ef7aa..67a46f55caf 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -795,6 +795,17 @@ bool OSystem_Android::getFeatureState(Feature f) {
 	}
 }
 
+void OSystem_Android::setPause(bool value) {
+	if (g_engine) {
+		LOGD("pauseEngine: %d", value);
+
+		if (value)
+			_pauseToken = g_engine->pauseEngine();
+		else if (_pauseToken.isActive())
+			_pauseToken.clear();
+	}
+}
+
 // TODO Re-eval if we need this here
 Common::HardwareInputSet *OSystem_Android::getHardwareInputSet() {
 	using namespace Common;
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index 6e277a11073..1df7f085e3b 100644
--- a/backends/platform/android/android.h
+++ b/backends/platform/android/android.h
@@ -34,6 +34,7 @@
 #include "backends/fs/posix/posix-fs-factory.h"
 #include "backends/log/log.h"
 #include "backends/platform/android/touchcontrols.h"
+#include "engines/engine.h"
 
 #include <pthread.h>
 
@@ -147,6 +148,8 @@ private:
 	Audio::MixerImpl *_mixer;
 	timeval _startTime;
 
+	PauseToken _pauseToken;
+
 	Common::Queue<Common::Event> _event_queue;
 	EventWithDelay _delayedMouseBtnUpEvent;
 	EventWithDelay _delayedMouseBtnDownEvent;
@@ -221,6 +224,8 @@ public:
 	void setFeatureState(OSystem::Feature f, bool enable) override;
 	bool getFeatureState(OSystem::Feature f) override;
 
+	void setPause(bool pause);
+
 	void pushEvent(int type, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6);
 	void pushEvent(const Common::Event &event);
 	void pushEvent(const Common::Event &event1, const Common::Event &event2);
diff --git a/backends/platform/android/jni-android.cpp b/backends/platform/android/jni-android.cpp
index ccfd57d0a05..40e06d58ba4 100644
--- a/backends/platform/android/jni-android.cpp
+++ b/backends/platform/android/jni-android.cpp
@@ -118,8 +118,6 @@ jmethodID JNI::_MID_AudioTrack_play = 0;
 jmethodID JNI::_MID_AudioTrack_stop = 0;
 jmethodID JNI::_MID_AudioTrack_write = 0;
 
-PauseToken JNI::_pauseToken;
-
 const JNINativeMethod JNI::_natives[] = {
 	{ "create", "(Landroid/content/res/AssetManager;"
 				"Ljavax/microedition/khronos/egl/EGL10;"
@@ -966,14 +964,7 @@ void JNI::setPause(JNIEnv *env, jobject self, jboolean value) {
 	if (!_system)
 		return;
 
-	if (g_engine) {
-		LOGD("pauseEngine: %d", value);
-
-		if (value)
-			JNI::_pauseToken = g_engine->pauseEngine();
-		else if (JNI::_pauseToken.isActive())
-			JNI::_pauseToken.clear();
-	}
+	_system->setPause(value);
 
 	if (pause != value) {
 		pause = value;
diff --git a/backends/platform/android/jni-android.h b/backends/platform/android/jni-android.h
index bf486a927e4..b804c933d8f 100644
--- a/backends/platform/android/jni-android.h
+++ b/backends/platform/android/jni-android.h
@@ -30,7 +30,6 @@
 #include "common/archive.h"
 #include "common/array.h"
 #include "common/ustr.h"
-#include "engines/engine.h"
 
 namespace Graphics {
 	struct Surface;
@@ -211,8 +210,6 @@ private:
 	static jstring convertToJString(JNIEnv *env, const Common::U32String &str);
 	static Common::U32String convertFromJString(JNIEnv *env, const jstring &jstr);
 
-	static PauseToken _pauseToken;
-
 	static JNIEnv *fetchEnv();
 	static int fetchEGLVersion();
 };




More information about the Scummvm-git-logs mailing list