[Scummvm-git-logs] scummvm master -> 31620b89667309f116790a5e8ea9ba87b546f83e

spleen1981 noreply at scummvm.org
Wed Aug 26 13:30:33 UTC 2026


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

Summary:
545e40bdbe LIBRETRO: Make context_reset_pending flag cross-thread safe with atomics
a0ab0ca688 LIBRETRO: Log when retro_load_game fails to reinitialize on core reset
7fc17c3631 LIBRETRO: Remove dead browser_lastpath branch in checkPathSetting
44ba432435 LIBRETRO: Initialize all flags in LibRetroFilesystemNode default constructor
6273e2f30a LIBRETRO: Fix duplicated '+' typo in hook file path concatenation
3ed2b63298 LIBRETRO: Own a stable copy of game_buf.path used by retro_reset()
830b1ab045 LIBRETRO: Bounds-check cmd_params parsing and replace sprintf with snprinf
a6d12a10aa LIBRETRO: add SAF location count debug log
e42130a5ad LIBRETRO: fix libco check_stack_headroom
3afe8f05f2 LIBRETRO: fix av_status reset
253a617269 LIBRETRO: Service a pending reset before reinitialising frontend AV state
465de6b035 LIBRETRO: Dispose of backend managers before reallocating them in initBackend
27fad8f412 LIBRETRO: Re-query authorized storage roots on reset
31620b8966 LIBRETRO: BUILD: Build the Android target without libco


Commit: 545e40bdbebe1d6df5c18560d46b9bf0f246b03c
    https://github.com/scummvm/scummvm/commit/545e40bdbebe1d6df5c18560d46b9bf0f246b03c
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2026-08-26T15:25:35+02:00

Commit Message:
LIBRETRO: Make context_reset_pending flag cross-thread safe with atomics

Changed paths:
    backends/platform/libretro/src/libretro-core.cpp


diff --git a/backends/platform/libretro/src/libretro-core.cpp b/backends/platform/libretro/src/libretro-core.cpp
index 7848191c733..2a1368ef3a8 100644
--- a/backends/platform/libretro/src/libretro-core.cpp
+++ b/backends/platform/libretro/src/libretro-core.cpp
@@ -115,16 +115,19 @@ static bool updating_variables = false;
 #ifdef USE_OPENGL
 static struct retro_hw_render_callback hw_render;
 
-static bool context_reset_pending = false;
+/* Set on the frontend thread by context_reset(), consumed on the emulation
+ * thread by retro_consume_context_reset(). */
+static retro_atomic_int_t context_reset_pending = RETRO_ATOMIC_INT_INITIALIZER(0);
 
 void retro_set_context_reset_pending(void) {
-	context_reset_pending = true;
+	retro_atomic_store_release_int(&context_reset_pending, 1);
 }
 
 bool retro_consume_context_reset(void) {
-	bool pending = context_reset_pending;
-	context_reset_pending = false;
-	return pending;
+	if (!retro_atomic_load_acquire_int(&context_reset_pending))
+		return false;
+	retro_atomic_store_release_int(&context_reset_pending, 0);
+	return true;
 }
 
 static void context_reset(void) {


Commit: a0ab0ca688de912ce11e84228090b60f043df50d
    https://github.com/scummvm/scummvm/commit/a0ab0ca688de912ce11e84228090b60f043df50d
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2026-08-26T15:25:53+02:00

Commit Message:
LIBRETRO: Log when retro_load_game fails to reinitialize on core reset

Changed paths:
    backends/platform/libretro/src/libretro-core.cpp


diff --git a/backends/platform/libretro/src/libretro-core.cpp b/backends/platform/libretro/src/libretro-core.cpp
index 2a1368ef3a8..9a8380dfc7d 100644
--- a/backends/platform/libretro/src/libretro-core.cpp
+++ b/backends/platform/libretro/src/libretro-core.cpp
@@ -1304,7 +1304,8 @@ void retro_unload_game(void) {
 void retro_reset(void) {
 	close_emu_thread();
 	init_command_params();
-	retro_load_game(game_buf_ptr);
+	if (!retro_load_game(game_buf_ptr) && retro_log_cb)
+		retro_log_cb(RETRO_LOG_ERROR, "[scummvm] Failed to reinitialize emulation thread on reset.\n");
 	LIBRETRO_G_SYSTEM->resetQuit();
 }
 


Commit: 7fc17c3631d4118a74330d96e9a2647cd03b2b9d
    https://github.com/scummvm/scummvm/commit/7fc17c3631d4118a74330d96e9a2647cd03b2b9d
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2026-08-26T15:26:09+02:00

Commit Message:
LIBRETRO: Remove dead browser_lastpath branch in checkPathSetting

Changed paths:
    backends/platform/libretro/src/libretro-os-utils.cpp


diff --git a/backends/platform/libretro/src/libretro-os-utils.cpp b/backends/platform/libretro/src/libretro-os-utils.cpp
index af046d2cf9b..c81781dafcb 100644
--- a/backends/platform/libretro/src/libretro-os-utils.cpp
+++ b/backends/platform/libretro/src/libretro-os-utils.cpp
@@ -170,9 +170,7 @@ bool OSystem_libretro::checkPathSetting(const char *setting, Common::String cons
 	Common::String setPath;
 	if (ConfMan.hasKey(setting))
 		setPath = Common::Path::fromConfig(ConfMan.get(setting)).toString();
-	if (!strcmp(setting, "browser_lastpath") && setPath == "/" && !defaultPath.empty() && defaultPath != "/")
-		ConfMan.removeKey(setting, Common::ConfigManager::kApplicationDomain);
-	else if (setPath.empty() || !(isDirectory ? LibRetroFilesystemNode(setPath).isDirectory() : LibRetroFilesystemNode(setPath).exists()))
+	if (setPath.empty() || !(isDirectory ? LibRetroFilesystemNode(setPath).isDirectory() : LibRetroFilesystemNode(setPath).exists()))
 		ConfMan.removeKey(setting, Common::ConfigManager::kApplicationDomain);
 
 	if (! ConfMan.hasKey(setting))


Commit: 44ba4324359e7d822cce999e9edcf536a564963c
    https://github.com/scummvm/scummvm/commit/44ba4324359e7d822cce999e9edcf536a564963c
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2026-08-26T15:26:29+02:00

Commit Message:
LIBRETRO: Initialize all flags in LibRetroFilesystemNode default constructor

Changed paths:
    backends/platform/libretro/include/libretro-fs.h


diff --git a/backends/platform/libretro/include/libretro-fs.h b/backends/platform/libretro/include/libretro-fs.h
index 91bcc62b669..ded093ea05c 100644
--- a/backends/platform/libretro/include/libretro-fs.h
+++ b/backends/platform/libretro/include/libretro-fs.h
@@ -50,7 +50,7 @@ protected:
 	/**
 	 * Plain constructor, for internal use only (hence protected).
 	 */
-	LibRetroFilesystemNode() : _isDirectory(false), _isValid(false) {}
+	LibRetroFilesystemNode() : _isDirectory(false), _isValid(false), _isReadable(false), _isWritable(false) {}
 
 public:
 	/**


Commit: 6273e2f30a8ae99f5cc0240dc904157a2cf59d95
    https://github.com/scummvm/scummvm/commit/6273e2f30a8ae99f5cc0240dc904157a2cf59d95
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2026-08-26T15:26:49+02:00

Commit Message:
LIBRETRO: Fix duplicated '+' typo in hook file path concatenation

Changed paths:
    backends/platform/libretro/src/libretro-options-widget.cpp


diff --git a/backends/platform/libretro/src/libretro-options-widget.cpp b/backends/platform/libretro/src/libretro-options-widget.cpp
index d75dbcc52c2..b256945cf9d 100644
--- a/backends/platform/libretro/src/libretro-options-widget.cpp
+++ b/backends/platform/libretro/src/libretro-options-widget.cpp
@@ -203,7 +203,7 @@ bool LibretroOptionsWidget::generatePlaylist(Common::String playlistPath) {
 
 		title = iter->_key;
 		iter->_value.tryGetVal("description", title);
-		hookFilePath = hookPath + + "/" + iter->_key.c_str() + "." + CORE_EXTENSIONS;
+		hookFilePath = hookPath + "/" + iter->_key.c_str() + "." + CORE_EXTENSIONS;
 
 		if (ConfMan.getInt("libretro_playlist_version", _domain) != kPlaylistFormat6lines) {
 			Common::JSONObject item;


Commit: 3ed2b63298a6f04c195a72769e13fff945f178e7
    https://github.com/scummvm/scummvm/commit/3ed2b63298a6f04c195a72769e13fff945f178e7
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2026-08-26T15:27:07+02:00

Commit Message:
LIBRETRO: Own a stable copy of game_buf.path used by retro_reset()

Changed paths:
    backends/platform/libretro/src/libretro-core.cpp


diff --git a/backends/platform/libretro/src/libretro-core.cpp b/backends/platform/libretro/src/libretro-core.cpp
index 9a8380dfc7d..33c1cce2500 100644
--- a/backends/platform/libretro/src/libretro-core.cpp
+++ b/backends/platform/libretro/src/libretro-core.cpp
@@ -63,6 +63,10 @@
 
 static struct retro_game_info game_buf;
 static struct retro_game_info *game_buf_ptr;
+/* retro_game_info::path is a frontend-owned pointer; retro_reset() reuses
+ * game_buf_ptr to relaunch, so it must not depend on that pointer staying
+ * valid after the initial retro_load_game() call. Own a stable copy instead. */
+static char game_buf_path[RETRO_PATH_MAX];
 
 retro_log_printf_t retro_log_cb = NULL;
 retro_input_state_t retro_input_cb = NULL;
@@ -1127,6 +1131,13 @@ bool retro_load_game(const struct retro_game_info *game) {
 	if (game) {
 		game_buf_ptr = &game_buf;
 		memcpy(game_buf_ptr, game, sizeof(retro_game_info));
+		if (game->path) {
+			strncpy(game_buf_path, game->path, sizeof(game_buf_path) - 1);
+			game_buf_path[sizeof(game_buf_path) - 1] = '\0';
+		} else {
+			game_buf_path[0] = '\0';
+		}
+		game_buf.path = game_buf_path;
 		// Retrieve the game path.
 		Common::FSNode detect_target = Common::FSNode(game->path);
 		Common::FSNode parent_dir = detect_target.getParent();


Commit: 830b1ab04518e3f893e0d3ac4d5f42a9f34c71eb
    https://github.com/scummvm/scummvm/commit/830b1ab04518e3f893e0d3ac4d5f42a9f34c71eb
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2026-08-26T15:27:31+02:00

Commit Message:
LIBRETRO: Bounds-check cmd_params parsing and replace sprintf with snprinf

Changed paths:
    backends/platform/libretro/src/libretro-core.cpp


diff --git a/backends/platform/libretro/src/libretro-core.cpp b/backends/platform/libretro/src/libretro-core.cpp
index 33c1cce2500..6809a97f388 100644
--- a/backends/platform/libretro/src/libretro-core.cpp
+++ b/backends/platform/libretro/src/libretro-core.cpp
@@ -42,6 +42,7 @@
 
 #include <features/features_cpu.h> // cpu_features_get_time_usec()
 #include <retro_atomic.h>
+#include <retro_miscellaneous.h> // PATH_MAX_LENGTH
 
 /**
  * Include base/internal_version.h to allow access to SCUMMVM_VERSION.
@@ -66,7 +67,7 @@ static struct retro_game_info *game_buf_ptr;
 /* retro_game_info::path is a frontend-owned pointer; retro_reset() reuses
  * game_buf_ptr to relaunch, so it must not depend on that pointer staying
  * valid after the initial retro_load_game() call. Own a stable copy instead. */
-static char game_buf_path[RETRO_PATH_MAX];
+static char game_buf_path[PATH_MAX_LENGTH];
 
 retro_log_printf_t retro_log_cb = NULL;
 retro_input_state_t retro_input_cb = NULL;
@@ -733,6 +734,28 @@ int retro_get_input_device(void) {
 	return retro_input_device;
 }
 
+/* Bounds-checked append to cmd_params: silently drops parameters past the
+ * fixed-size array capacity/width instead of overflowing them. */
+static bool append_command_param(const char *param) {
+	if (cmd_params_num >= ARRAYSIZE(cmd_params)) {
+		if (retro_log_cb)
+			retro_log_cb(RETRO_LOG_ERROR, "[scummvm] Too many command line parameters, ignoring '%s'.\n", param);
+		return false;
+	}
+
+	size_t param_len = strlen(param);
+
+	if (param_len >= sizeof(cmd_params[cmd_params_num])) {
+		if (retro_log_cb)
+			retro_log_cb(RETRO_LOG_ERROR, "[scummvm] Command line parameter too long, ignoring '%s'.\n", param);
+		return false;
+	}
+
+	memcpy(cmd_params[cmd_params_num], param, param_len + 1);
+	cmd_params_num++;
+	return true;
+}
+
 void parse_command_params(char *cmdline) {
 	int j = 0;
 	int cmdlen = strlen(cmdline);
@@ -750,8 +773,7 @@ void parse_command_params(char *cmdline) {
 		case '\"':
 			if (quotes) {
 				cmdline[i] = '\0';
-				strcpy(cmd_params[cmd_params_num], cmdline + j);
-				cmd_params_num++;
+				append_command_param(cmdline + j);
 				quotes = false;
 			} else
 				quotes = true;
@@ -762,8 +784,7 @@ void parse_command_params(char *cmdline) {
 			if (!quotes) {
 				if (i != j && !quotes) {
 					cmdline[i] = '\0';
-					strcpy(cmd_params[cmd_params_num], cmdline + j);
-					cmd_params_num++;
+					append_command_param(cmdline + j);
 				}
 				j = i + 1;
 			}
@@ -1123,8 +1144,7 @@ bool retro_load_game(const struct retro_game_info *game) {
 	}
 
 #ifdef LIBRETRO_DEBUG
-	char debug_buf [20];
-	sprintf(debug_buf, "--debuglevel=11");
+	char debug_buf[] = "--debuglevel=11";
 	parse_command_params(debug_buf);
 #endif
 
@@ -1192,15 +1212,15 @@ bool retro_load_game(const struct retro_game_info *game) {
 		// Preliminary game scan results
 		switch (test_game_status) {
 		case TEST_GAME_OK_ID_FOUND:
-			sprintf(buffer, "-p \"%s\" %s", parent_dir.getPath().toString().c_str(), target_id);
+			snprintf(buffer, sizeof(buffer), "-p \"%s\" %s", parent_dir.getPath().toString().c_str(), target_id);
 			retro_log_cb(RETRO_LOG_DEBUG, "[scummvm] launch via target id and game dir\n");
 			break;
 		case TEST_GAME_OK_TARGET_FOUND:
-			sprintf(buffer, "%s", target_id);
+			snprintf(buffer, sizeof(buffer), "%s", target_id);
 			retro_log_cb(RETRO_LOG_DEBUG, "[scummvm] launch via target id and scummvm.ini\n");
 			break;
 		case TEST_GAME_OK_ID_AUTODETECTED:
-			sprintf(buffer, "-p \"%s\" --auto-detect", parent_dir.getPath().toString().c_str());
+			snprintf(buffer, sizeof(buffer), "-p \"%s\" --auto-detect", parent_dir.getPath().toString().c_str());
 			retro_log_cb(RETRO_LOG_DEBUG, "[scummvm] launch via autodetect\n");
 			break;
 		case TEST_GAME_KO_MULTIPLE_RESULTS:


Commit: a6d12a10aab0a441dcf080699f95761019ed2741
    https://github.com/scummvm/scummvm/commit/a6d12a10aab0a441dcf080699f95761019ed2741
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2026-08-26T15:27:47+02:00

Commit Message:
LIBRETRO: add SAF location count debug log

Changed paths:
    backends/platform/libretro/src/libretro-core.cpp


diff --git a/backends/platform/libretro/src/libretro-core.cpp b/backends/platform/libretro/src/libretro-core.cpp
index 6809a97f388..f517d4e5c63 100644
--- a/backends/platform/libretro/src/libretro-core.cpp
+++ b/backends/platform/libretro/src/libretro-core.cpp
@@ -1025,6 +1025,9 @@ void retro_init(void) {
 	else
 		retro_log_cb = NULL;
 
+	if (retro_log_cb)
+		retro_log_cb(RETRO_LOG_DEBUG, "ScummVM core version: %s\n", __GIT_VERSION);
+
 	struct retro_vfs_interface_info vfs_iface;
 	vfs_iface.required_interface_version = STAT64_REQUIRED_VFS_VERSION;
 	vfs_iface.iface = nullptr;
@@ -1045,6 +1048,8 @@ void retro_init(void) {
 
 		if (environ_cb && environ_cb(RETRO_ENVIRONMENT_GET_VFS_AUTHORIZED_LOCATIONS, &locations) &&
 				locations.locations) {
+			if (retro_log_cb)
+				retro_log_cb(RETRO_LOG_DEBUG, "SAF locations count: %zu\n", locations.count);
 			for (size_t i = 0; i < locations.count; ++i) {
 				const char *path = locations.locations[i].path;
 				const char *label = locations.locations[i].label;
@@ -1057,14 +1062,11 @@ void retro_init(void) {
 		}
 	}
 
-	if (retro_log_cb)
-		retro_log_cb(RETRO_LOG_DEBUG, "ScummVM core version: %s\n", __GIT_VERSION);
-
 	update_variables();
 
 	if (retro_setting_get_browsing_mode_authorized() && !LibRetroFilesystemNode::hasAuthorizedLocations()) {
 		if (retro_log_cb)
-			retro_log_cb(RETRO_LOG_WARN, "[scummvm] Browsing mode set to 'Authorized storage' but no authorized locations are available; falling back to local filesystem. Authorize folders from the frontend and restart the core.\n");
+			retro_log_cb(RETRO_LOG_WARN, "Browsing mode set to 'Authorized storage' but no authorized locations are available; falling back to local filesystem. Authorize folders from the frontend and restart the core.\n");
 		retro_osd_notification("No authorized storage available, using local filesystem.");
 	}
 


Commit: e42130a5addef1bfbe6b3b6b83c1a9eaf7e25582
    https://github.com/scummvm/scummvm/commit/e42130a5addef1bfbe6b3b6b83c1a9eaf7e25582
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2026-08-26T15:27:59+02:00

Commit Message:
LIBRETRO: fix libco check_stack_headroom

Changed paths:
    backends/platform/libretro/src/libretro-threads.cpp


diff --git a/backends/platform/libretro/src/libretro-threads.cpp b/backends/platform/libretro/src/libretro-threads.cpp
index c81ecd33c91..82173898c80 100644
--- a/backends/platform/libretro/src/libretro-threads.cpp
+++ b/backends/platform/libretro/src/libretro-threads.cpp
@@ -52,12 +52,15 @@ static bool stack_warned = false;
 
 static void check_stack_headroom(void) {
 	char probe;
+	ptrdiff_t diff;
 	size_t used;
 
 	if (!stack_anchor || stack_warned)
 		return;
 
-	used = (size_t)(stack_anchor - &probe);
+	diff = stack_anchor - &probe;
+	used = (size_t)(diff < 0 ? -diff : diff);
+
 	if (used < (EMU_THREAD_STACK_SIZE / 4) * 3)
 		return;
 


Commit: 3afe8f05f26be7b560b7bc0c97ad5798025ddbf7
    https://github.com/scummvm/scummvm/commit/3afe8f05f26be7b560b7bc0c97ad5798025ddbf7
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2026-08-26T15:28:15+02:00

Commit Message:
LIBRETRO: fix av_status reset

Changed paths:
    backends/platform/libretro/src/libretro-core.cpp


diff --git a/backends/platform/libretro/src/libretro-core.cpp b/backends/platform/libretro/src/libretro-core.cpp
index f517d4e5c63..84580c96fac 100644
--- a/backends/platform/libretro/src/libretro-core.cpp
+++ b/backends/platform/libretro/src/libretro-core.cpp
@@ -610,7 +610,7 @@ static void update_variables(void) {
 		av_status |= AUDIO_STATUS_UPDATE_LATENCY;
 		audio_buffer_init(sample_rate, (uint16) frame_rate);
 		if (g_system)
-			av_status |= (AV_STATUS_UPDATE_AV_INFO & AV_STATUS_RESET_PENDING);
+			av_status |= (AV_STATUS_UPDATE_AV_INFO | AV_STATUS_RESET_PENDING);
 	}
 
 	if (video_hw_mode & VIDEO_GRAPHIC_MODE_RESET_PENDING) {


Commit: 253a6172691bd55b6fb41931fdec87fa0d93b888
    https://github.com/scummvm/scummvm/commit/253a6172691bd55b6fb41931fdec87fa0d93b888
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2026-08-26T15:28:31+02:00

Commit Message:
LIBRETRO: Service a pending reset before reinitialising frontend AV state

Changed paths:
    backends/platform/libretro/src/libretro-core.cpp


diff --git a/backends/platform/libretro/src/libretro-core.cpp b/backends/platform/libretro/src/libretro-core.cpp
index 84580c96fac..b0f4da6a7a3 100644
--- a/backends/platform/libretro/src/libretro-core.cpp
+++ b/backends/platform/libretro/src/libretro-core.cpp
@@ -1257,6 +1257,12 @@ void retro_run(void) {
 	except in case of core options reset to defaults, for which the following call is needed*/
 	retro_update_options_display();
 
+	if (av_status & AV_STATUS_RESET_PENDING) {
+		av_status &= ~AV_STATUS_RESET_PENDING;
+		retro_reset();
+		return;
+	}
+
 #ifdef USE_HIGHRES
 	if (av_status & AV_STATUS_UPDATE_GUI) {
 		retro_gui_res_reset();
@@ -1287,12 +1293,6 @@ void retro_run(void) {
 		av_status &= ~AUDIO_STATUS_UPDATE_LATENCY;
 	}
 
-	if (av_status & AV_STATUS_RESET_PENDING) {
-		av_status &= ~AV_STATUS_RESET_PENDING;
-		retro_reset();
-		return;
-	}
-
 	/* Setting RA's video or audio driver to null will disable video/audio bits */
 	int audio_video_enable = 0;
 	if (!environ_cb(RETRO_ENVIRONMENT_GET_AUDIO_VIDEO_ENABLE, &audio_video_enable))


Commit: 465de6b03551612563080717b260864c02c7ec39
    https://github.com/scummvm/scummvm/commit/465de6b03551612563080717b260864c02c7ec39
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2026-08-26T15:28:47+02:00

Commit Message:
LIBRETRO: Dispose of backend managers before reallocating them in initBackend

Changed paths:
    backends/platform/libretro/src/libretro-os-base.cpp


diff --git a/backends/platform/libretro/src/libretro-os-base.cpp b/backends/platform/libretro/src/libretro-os-base.cpp
index 47a22223ba9..87ef2f01e9d 100644
--- a/backends/platform/libretro/src/libretro-os-base.cpp
+++ b/backends/platform/libretro/src/libretro-os-base.cpp
@@ -71,6 +71,15 @@ void OSystem_libretro::initBackend() {
 	if (! ConfMan.hasKey("libretro_hooks_clear"))
 		ConfMan.set("libretro_hooks_clear", 0);
 
+	delete _timerManager;
+	_timerManager = nullptr;
+	delete _mixer;
+	_mixer = nullptr;
+	delete _savefileManager;
+	_savefileManager = nullptr;
+	delete _eventManager;
+	_eventManager = nullptr;
+
 	_eventManager = new DefaultEventManager(this);
 	_savefileManager = new DefaultSaveFileManager();
 


Commit: 27fad8f4125a530bb6314907667f1b0b91344efc
    https://github.com/scummvm/scummvm/commit/27fad8f4125a530bb6314907667f1b0b91344efc
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2026-08-26T15:29:01+02:00

Commit Message:
LIBRETRO: Re-query authorized storage roots on reset

Changed paths:
    backends/platform/libretro/src/libretro-core.cpp


diff --git a/backends/platform/libretro/src/libretro-core.cpp b/backends/platform/libretro/src/libretro-core.cpp
index b0f4da6a7a3..98c4568b78e 100644
--- a/backends/platform/libretro/src/libretro-core.cpp
+++ b/backends/platform/libretro/src/libretro-core.cpp
@@ -168,11 +168,7 @@ static void retro_gui_res_reset() {
 #endif
 
 /* Single-producer / single-consumer ring. The producer is ScummVM's MIDI
-   driver, the consumer is retro_midi_queue_drain() in retro_run(). With
-   USE_LIBCO those are the same OS thread and the fences below cost nothing;
-   without it they are two threads, and 'volatile' does not order the payload
-   stores against the cursor publish - the consumer could see an index before
-   the event it points at. */
+   driver, the consumer is retro_midi_queue_drain() in retro_run(). */
 static retro_midi_event_t midi_queue[MIDI_QUEUE_SIZE];
 static retro_atomic_int_t midi_head = RETRO_ATOMIC_INT_INITIALIZER(0); /* published by producer */
 static retro_atomic_int_t midi_tail = RETRO_ATOMIC_INT_INITIALIZER(0); /* published by consumer */
@@ -1018,6 +1014,30 @@ static void retro_midi_queue_drain(void) {
 	}
 }
 
+/* Authorized storage roots (e.g. Android SAF trees) as granted through the
+ * frontend. */
+static void refresh_authorized_locations(void) {
+	LibRetroFilesystemNode::clearAuthorizedLocations();
+
+	struct retro_vfs_authorized_locations locations;
+	memset(&locations, 0, sizeof(locations));
+
+	if (environ_cb && environ_cb(RETRO_ENVIRONMENT_GET_VFS_AUTHORIZED_LOCATIONS, &locations) &&
+			locations.locations) {
+		if (retro_log_cb)
+			retro_log_cb(RETRO_LOG_DEBUG, "SAF locations count: %zu\n", locations.count);
+		for (size_t i = 0; i < locations.count; ++i) {
+			const char *path = locations.locations[i].path;
+			const char *label = locations.locations[i].label;
+
+			if (path && *path)
+				LibRetroFilesystemNode::addAuthorizedLocation(
+						Common::String(path),
+						label ? Common::String(label) : Common::String());
+		}
+	}
+}
+
 void retro_init(void) {
 	struct retro_log_callback log;
 	if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log))
@@ -1040,27 +1060,7 @@ void retro_init(void) {
 		dirent_vfs_init(&vfs_iface);
 	}
 
-	LibRetroFilesystemNode::clearAuthorizedLocations();
-
-	{
-		struct retro_vfs_authorized_locations locations;
-		memset(&locations, 0, sizeof(locations));
-
-		if (environ_cb && environ_cb(RETRO_ENVIRONMENT_GET_VFS_AUTHORIZED_LOCATIONS, &locations) &&
-				locations.locations) {
-			if (retro_log_cb)
-				retro_log_cb(RETRO_LOG_DEBUG, "SAF locations count: %zu\n", locations.count);
-			for (size_t i = 0; i < locations.count; ++i) {
-				const char *path = locations.locations[i].path;
-				const char *label = locations.locations[i].label;
-
-				if (path && *path)
-					LibRetroFilesystemNode::addAuthorizedLocation(
-							Common::String(path),
-							label ? Common::String(label) : Common::String());
-			}
-		}
-	}
+	refresh_authorized_locations();
 
 	update_variables();
 
@@ -1337,6 +1337,7 @@ void retro_unload_game(void) {
 void retro_reset(void) {
 	close_emu_thread();
 	init_command_params();
+	refresh_authorized_locations();
 	if (!retro_load_game(game_buf_ptr) && retro_log_cb)
 		retro_log_cb(RETRO_LOG_ERROR, "[scummvm] Failed to reinitialize emulation thread on reset.\n");
 	LIBRETRO_G_SYSTEM->resetQuit();


Commit: 31620b89667309f116790a5e8ea9ba87b546f83e
    https://github.com/scummvm/scummvm/commit/31620b89667309f116790a5e8ea9ba87b546f83e
Author: Giovanni Cascione (ing.cascione at gmail.com)
Date: 2026-08-26T15:29:37+02:00

Commit Message:
LIBRETRO: BUILD: Build the Android target without libco

Changed paths:
    backends/platform/libretro/jni/Android.mk


diff --git a/backends/platform/libretro/jni/Android.mk b/backends/platform/libretro/jni/Android.mk
index 0c2ef19d2d1..74d49c16b6a 100644
--- a/backends/platform/libretro/jni/Android.mk
+++ b/backends/platform/libretro/jni/Android.mk
@@ -4,6 +4,9 @@ TARGET_NAME := scummvm
 HAVE_OPENGLES2 := 1
 USE_IMGUI := 0
 USE_LIBRETRO_SAF := 1
+# SAF reaches Android storage through JNI, and JNI calls have to come from a
+# thread ART knows about - not from a cothread stack handed out by co_create().
+USE_LIBCO := 0
 
 # Reset flags not reset to Makefile.common
 DEFINES   :=




More information about the Scummvm-git-logs mailing list