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

sev- noreply at scummvm.org
Sun Aug 6 21:07:40 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:
9de5b3345c OSYSTEM: Add functions to notify the backend when a task is started or finished
b0ae8424c9 NETWORKING: Notify the backend when starting or stopping the local web server
e0c67c3949 CLOUD: Notify the backend starting or finishing a download from the cloud
d10e4d682a GUI: Notify the backend when starting or finishing an icons or shaders pack download
fc51e86b3d IOS7: Prevent sleep when a task is running


Commit: 9de5b3345c9f474c25b84d4bc6bc8140f5927998
    https://github.com/scummvm/scummvm/commit/9de5b3345c9f474c25b84d4bc6bc8140f5927998
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-08-06T23:07:35+02:00

Commit Message:
OSYSTEM: Add functions to notify the backend when a task is started or finished

A task can for example be running the local server, downloading icons
or shaders pack, or downloading games from the cloud.

Changed paths:
    common/system.h


diff --git a/common/system.h b/common/system.h
index d07d26e0356..121a18530fe 100644
--- a/common/system.h
+++ b/common/system.h
@@ -326,6 +326,36 @@ public:
 	 */
 	virtual void engineDone() { }
 
+	/**
+	 * Identify a task that ScummVM can perform.
+	 */
+	enum Task {
+		/**
+		 * The local server is running, allowing connections from other devices to transfer files.
+		 */
+		kLocalServer,
+
+		/**
+		 * ScummVM is downloading games or synchronizing savegames from the cloud.
+		 */
+		kCloudDownload,
+
+		/**
+		 * ScummVM is downloading an icons or shaders pack.
+		 */
+		kDataPackDownload
+	};
+
+	/**
+	 * Allow the backend to be notified when a task is started.
+	 */
+	virtual void taskStarted(Task) { }
+
+	/**
+	 * Allow the backend to be notified when a task is finished.
+	 */
+	virtual void taskFinished(Task) { }
+
 	/**
 	 * Allow the backend to customize the start settings, such as for example starting
 	 * automatically a game under certain circumstances.


Commit: b0ae8424c943e28f107e3f569aec6a7bb4869e76
    https://github.com/scummvm/scummvm/commit/b0ae8424c943e28f107e3f569aec6a7bb4869e76
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-08-06T23:07:35+02:00

Commit Message:
NETWORKING: Notify the backend when starting or stopping the local web server

Changed paths:
    backends/networking/sdl_net/localwebserver.cpp


diff --git a/backends/networking/sdl_net/localwebserver.cpp b/backends/networking/sdl_net/localwebserver.cpp
index 7bae7035c12..18eb0f69eec 100644
--- a/backends/networking/sdl_net/localwebserver.cpp
+++ b/backends/networking/sdl_net/localwebserver.cpp
@@ -143,13 +143,19 @@ void LocalWebserver::start(bool useMinimalMode) {
 	if (numused == -1) {
 		error("LocalWebserver: SDLNet_AddSocket: %s\n", SDLNet_GetError());
 	}
+
+	if (_timerStarted)
+		g_system->taskStarted(OSystem::kLocalServer);
+
 	_handleMutex.unlock();
 }
 
 void LocalWebserver::stop() {
 	_handleMutex.lock();
-	if (_timerStarted)
+	if (_timerStarted) {
 		stopTimer();
+		g_system->taskFinished(OSystem::kLocalServer);
+	}
 
 	if (_serverSocket) {
 		SDLNet_TCP_Close(_serverSocket);


Commit: e0c67c39493be932e5222aad8ef1b56977d61ca2
    https://github.com/scummvm/scummvm/commit/e0c67c39493be932e5222aad8ef1b56977d61ca2
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-08-06T23:07:35+02:00

Commit Message:
CLOUD: Notify the backend starting or finishing a download from the cloud

Changed paths:
    backends/cloud/storage.cpp


diff --git a/backends/cloud/storage.cpp b/backends/cloud/storage.cpp
index ae8c09bcff7..7292fb69b56 100644
--- a/backends/cloud/storage.cpp
+++ b/backends/cloud/storage.cpp
@@ -57,8 +57,10 @@ void Storage::printErrorResponse(Networking::ErrorResponse error) {
 Networking::Request *Storage::addRequest(Networking::Request *request) {
 	_runningRequestsMutex.lock();
 	++_runningRequestsCount;
-	if (_runningRequestsCount == 1)
+	if (_runningRequestsCount == 1) {
+		g_system->taskStarted(OSystem::kCloudDownload);
 		debug(9, "Storage is working now");
+	}
 	_runningRequestsMutex.unlock();
 	return ConnMan.addRequest(request, new Common::Callback<Storage, Networking::Request *>(this, &Storage::requestFinishedCallback));
 }
@@ -72,8 +74,10 @@ void Storage::requestFinishedCallback(Networking::Request *invalidRequestPointer
 	--_runningRequestsCount;
 	if (_syncRestartRequestsed)
 		restartSync = true;
-	if (_runningRequestsCount == 0 && !restartSync)
+	if (_runningRequestsCount == 0) {
+		g_system->taskFinished(OSystem::kCloudDownload);
 		debug(9, "Storage is not working now");
+	}
 	_runningRequestsMutex.unlock();
 
 	if (restartSync)


Commit: d10e4d682aec35d24ac2d9db4707e870eb9dae30
    https://github.com/scummvm/scummvm/commit/d10e4d682aec35d24ac2d9db4707e870eb9dae30
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-08-06T23:07:35+02:00

Commit Message:
GUI: Notify the backend when starting or finishing an icons or shaders pack download

Changed paths:
    gui/downloadpacksdialog.cpp


diff --git a/gui/downloadpacksdialog.cpp b/gui/downloadpacksdialog.cpp
index 412116d3c4c..cead93e6a3f 100644
--- a/gui/downloadpacksdialog.cpp
+++ b/gui/downloadpacksdialog.cpp
@@ -88,6 +88,7 @@ void DialogState::downloadList() {
 
 void DialogState::proceedDownload() {
 	startTime = lastUpdate = g_system->getMillis();
+	g_system->taskStarted(OSystem::kDataPackDownload);
 	takeOneFile();
 }
 
@@ -142,6 +143,7 @@ void DialogState::downloadFileCallback(Networking::DataResponse r) {
 	if (response->eos) {
 		if (!takeOneFile()) {
 			state = kDownloadComplete;
+			g_system->taskFinished(OSystem::kDataPackDownload);
 			if (dialog)
 				dialog->sendCommand(kDownloadEndedCmd, 0);
 			return;
@@ -157,6 +159,7 @@ void DialogState::downloadFileCallback(Networking::DataResponse r) {
 void DialogState::errorCallback(Networking::ErrorResponse error) {
 	Common::U32String message = Common::U32String::format(_("ERROR %d: %s"), error.httpResponseCode, error.response.c_str());
 
+	g_system->taskFinished(OSystem::kDataPackDownload);
 	if (dialog)
 		dialog->setError(message);
 }


Commit: fc51e86b3da41ee477bc7600e86dc084d81d364a
    https://github.com/scummvm/scummvm/commit/fc51e86b3da41ee477bc7600e86dc084d81d364a
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2023-08-06T23:07:35+02:00

Commit Message:
IOS7: Prevent sleep when a task is running

Changed paths:
    backends/platform/ios7/ios7_osys_main.cpp
    backends/platform/ios7/ios7_osys_main.h
    backends/platform/ios7/ios7_osys_video.mm


diff --git a/backends/platform/ios7/ios7_osys_main.cpp b/backends/platform/ios7/ios7_osys_main.cpp
index 6691c009408..b6fa471315d 100644
--- a/backends/platform/ios7/ios7_osys_main.cpp
+++ b/backends/platform/ios7/ios7_osys_main.cpp
@@ -91,7 +91,7 @@ OSystem_iOS7::OSystem_iOS7() :
 	_mixer(NULL), _lastMouseTap(0), _queuedEventTime(0),
 	_secondaryTapped(false), _lastSecondaryTap(0),
 	_screenOrientation(kScreenOrientationAuto),
-	_timeSuspended(0) {
+	_timeSuspended(0), _runningTasks(0) {
 	_queuedInputEvent.type = Common::EVENT_INVALID;
 	_touchpadModeEnabled = ConfMan.getBool("touchpad_mode");
 	_mouseClickAndDragEnabled = ConfMan.getBool("clickanddrag_mode");
diff --git a/backends/platform/ios7/ios7_osys_main.h b/backends/platform/ios7/ios7_osys_main.h
index e51026984f3..40ffbbe3b8c 100644
--- a/backends/platform/ios7/ios7_osys_main.h
+++ b/backends/platform/ios7/ios7_osys_main.h
@@ -61,6 +61,8 @@ protected:
 	CFTimeInterval _startTime;
 	uint32 _timeSuspended;
 
+	int _runningTasks;
+
 	long _lastMouseDown;
 	long _lastMouseTap;
 	long _queuedEventTime;
@@ -91,6 +93,9 @@ public:
 	void engineInit() override;
 	void engineDone() override;
 
+	void taskStarted(Task) override;
+	void taskFinished(Task) override;
+
 	void updateStartSettings(const Common::String &executable, Common::String &command, Common::StringMap &settings, Common::StringArray& additionalArgs) override;
 
 	bool hasFeature(Feature f) override;
diff --git a/backends/platform/ios7/ios7_osys_video.mm b/backends/platform/ios7/ios7_osys_video.mm
index 2db4bbc090b..72f98ec171d 100644
--- a/backends/platform/ios7/ios7_osys_video.mm
+++ b/backends/platform/ios7/ios7_osys_video.mm
@@ -127,6 +127,24 @@ void OSystem_iOS7::engineDone() {
 #endif
 }
 
+void OSystem_iOS7::taskStarted(Task task) {
+	EventsBaseBackend::taskStarted(task);
+	if (_runningTasks++ == 0) {
+		// Prevent the device going to sleep while a task is running
+		dispatch_async(dispatch_get_main_queue(), ^{
+			[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
+		});
+	}
+}
+void OSystem_iOS7::taskFinished(Task task) {
+	EventsBaseBackend::taskFinished(task);
+	if (--_runningTasks == 0) {
+		dispatch_async(dispatch_get_main_queue(), ^{
+			[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
+		});
+	}
+}
+
 void OSystem_iOS7::updateOutputSurface() {
 	execute_on_main_thread(^ {
 		[[iOS7AppDelegate iPhoneView] initSurface];




More information about the Scummvm-git-logs mailing list