[Scummvm-git-logs] scummvm master -> 814d0121fc6838d3bb7a548de0634e1307c1c21e

dreammaster noreply at scummvm.org
Wed Apr 22 11:18:28 UTC 2026


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:
9061e86f89 MADS: PHANTOM: Populate savegame list from ScummVM savegames
814d0121fc MADS: PHANTOM: Fix crash entering staircase bottom


Commit: 9061e86f893f330f864c706b814dba9621b2cc7d
    https://github.com/scummvm/scummvm/commit/9061e86f893f330f864c706b814dba9621b2cc7d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-04-22T20:43:31+10:00

Commit Message:
MADS: PHANTOM: Populate savegame list from ScummVM savegames

Changed paths:
    engines/mads/madsv2/core/game.cpp
    engines/mads/madsv2/core/game.h
    engines/mads/madsv2/engine.cpp
    engines/mads/madsv2/engine.h
    engines/mads/madsv2/phantom/menus.cpp


diff --git a/engines/mads/madsv2/core/game.cpp b/engines/mads/madsv2/core/game.cpp
index 2ede5376fc2..58476891a65 100644
--- a/engines/mads/madsv2/core/game.cpp
+++ b/engines/mads/madsv2/core/game.cpp
@@ -2392,52 +2392,15 @@ void chain_execute() {
  * Reads the list of save files.
  */
 static void game_read_save_directory() {
-	int error_flag = true;
-	int mem_to_read;
-	Common::SeekableReadStream *handle = NULL;
-
-	mem_to_read = GAME_SAVE_SLOT_MEMORY;
-
-	handle = env_open(game_save_file, "rb");
-	if (handle == NULL) goto done;
-
-	if (!fileio_fread_f(game_save_directory, mem_to_read, 1, handle)) goto done;
-
-	error_flag = false;
+	SaveStateList list = g_engine->listSaves();
+	memset(game_save_directory, 0, GAME_MAX_SAVE_SLOTS * (GAME_MAX_SAVE_LENGTH + 1));
 
-done:
-	delete handle;
-	if (error_flag) {
-		memset(game_save_directory, 0, mem_to_read);
+	for (auto it = list.begin(); it != list.end(); ++it) {
+		char *slot = game_save_directory + it->getSaveSlot() * (GAME_MAX_SAVE_LENGTH + 1);
+		Common::strcpy_s(slot, GAME_MAX_SAVE_LENGTH + 1, it->getDescription().c_str());
 	}
 }
 
-void game_write_save_directory() {
-#ifdef TODO
-	int error_flag = true;
-	int mem_to_write;
-	Common::SeekableReadStream *handle = NULL;
-
-	mem_to_write = GAME_SAVE_SLOT_MEMORY;
-
-	handle = env_open(game_save_file, "wb");
-	if (handle == NULL) goto done;
-
-	if (!fileio_fwrite_f(game_save_directory, mem_to_write, 1, handle)) goto done;
-
-	error_flag = false;
-
-done:
-	if (handle != NULL) fclose(handle);
-
-	if (error_flag) {
-		error_report(ERROR_WRITE_SAVE_DIRECTORY, WARNING, MODULE_GAME_MENU, mem_to_write, 0);
-	}
-#else
-	error("TODO: game_write_save_directory");
-#endif
-}
-
 void game_menu_setup() {
 	long mem_to_get;
 
diff --git a/engines/mads/madsv2/core/game.h b/engines/mads/madsv2/core/game.h
index 7727af63094..1bbe1daa1ed 100644
--- a/engines/mads/madsv2/core/game.h
+++ b/engines/mads/madsv2/core/game.h
@@ -244,11 +244,6 @@ extern void game_exec_function(void (*(target))());
 extern void game_debugger_reset(void);
 extern void game_debugger(void);
 
-/**
- * Writes the list of save files.
- */
-extern void game_write_save_directory(void);
-
 /**
  * Sets up for the main menu routines to run--this mainly involves
  * getting enough memory to hold the save directory and menu heap.
diff --git a/engines/mads/madsv2/engine.cpp b/engines/mads/madsv2/engine.cpp
index 1a22d92d356..5eb8fab7da6 100644
--- a/engines/mads/madsv2/engine.cpp
+++ b/engines/mads/madsv2/engine.cpp
@@ -257,5 +257,9 @@ void MADSV2Engine::stopSpeech() {
 	_mixer->stopHandle(_speechHandle);
 }
 
+SaveStateList MADSV2Engine::listSaves() const {
+	return getMetaEngine()->listSaves(_targetName.c_str());
+}
+
 } // namespace MADSV2
 } // namespace MADS
diff --git a/engines/mads/madsv2/engine.h b/engines/mads/madsv2/engine.h
index 6b91acc1e85..b6d07936c79 100644
--- a/engines/mads/madsv2/engine.h
+++ b/engines/mads/madsv2/engine.h
@@ -92,6 +92,7 @@ public:
 	}
 	Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave) override;
 	Common::Error loadGameStream(Common::SeekableReadStream *stream) override;
+	SaveStateList listSaves() const;
 
 	virtual void global_init_code() = 0;
 	virtual void section_music(int section_num) = 0;
diff --git a/engines/mads/madsv2/phantom/menus.cpp b/engines/mads/madsv2/phantom/menus.cpp
index 8a22cc3cc33..2ca61f762bc 100644
--- a/engines/mads/madsv2/phantom/menus.cpp
+++ b/engines/mads/madsv2/phantom/menus.cpp
@@ -326,16 +326,12 @@ static void global_menu_save_restore(int save) {
 				Common::strcpy_s(save_game_name, GAME_MAX_SAVE_LENGTH, menu_quote(quote_menu_unnamed));
 			}
 			status = global_save(selection);
-			game_write_save_directory();
+
 		} else {
 			status = global_restore(selection);
 		}
 	}
 
-	if (save) {
-		game_write_save_directory();
-	}
-
 	if (status >= 0) {
 		global_alert(status);
 	}


Commit: 814d0121fc6838d3bb7a548de0634e1307c1c21e
    https://github.com/scummvm/scummvm/commit/814d0121fc6838d3bb7a548de0634e1307c1c21e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-04-22T21:18:16+10:00

Commit Message:
MADS: PHANTOM: Fix crash entering staircase bottom

Changed paths:
    engines/mads/madsv2/core/tile.cpp


diff --git a/engines/mads/madsv2/core/tile.cpp b/engines/mads/madsv2/core/tile.cpp
index 26870ab57fd..f729fd5a3db 100644
--- a/engines/mads/madsv2/core/tile.cpp
+++ b/engines/mads/madsv2/core/tile.cpp
@@ -514,7 +514,7 @@ int tile_buffer(Buffer *target, TileResource *tile_resource,
 	int map_y_offset;
 	int map_value;
 	Buffer tile_buffer;
-	int max_x;
+	int max_x, max_y;
 
 	default_value = (map->tile_type == TILE_PICTURE) ? 0 : 0xff;
 
@@ -529,11 +529,12 @@ int tile_buffer(Buffer *target, TileResource *tile_resource,
 
 	// WORKAROUND: For tile panning reading beyond end of buffer
 	max_x = MIN<int>(map->orig_x_tiles, map->num_x_tiles - tile_x);
+	max_y = MIN<int>(map->orig_y_tiles, map->num_y_tiles - tile_y);
 
-	for (y = 0; y < map->orig_y_tiles; y++) {
-
+	for (y = 0; y < max_y; y++) {
 		picture_y = y * map->tile_y_size;
 		map_y_offset = (y + tile_y) * map->num_x_tiles;
+
 		for (x = 0; x < max_x; x++) {
 			picture_x = x * size_x;
 			map_value = *(map->map + map_y_offset + tile_x + x);




More information about the Scummvm-git-logs mailing list