[Scummvm-git-logs] scummvm master -> 59643c70a1ce66c0c5f733b22bf9a86ca266a0f3

criezy noreply at scummvm.org
Mon Jun 20 22:53:59 UTC 2022


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

Summary:
d953e95a68 AGS: Add sanity check in putpixel to avoid overflow
e960e831b0 AGS: Remove unused variables for Allegro PACKFILE
fe80834639 AGS: Store DialogTopics in std::vector
59643c70a1 AGS: Add new detection entry for Gemini Rue and Shardlight


Commit: d953e95a682f515b0a42d85dec794471f908f611
    https://github.com/scummvm/scummvm/commit/d953e95a682f515b0a42d85dec794471f908f611
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-06-20T23:52:25+01:00

Commit Message:
AGS: Add sanity check in putpixel to avoid overflow

The alfont code seems to have some inconsistency between the real from
height and the maximum height used when drawing in alfont_textout_ex.
This can cause trying to write out of bounds, and then random crashes.

This fixes bug #13601

Changed paths:
    engines/ags/lib/allegro/gfx.cpp


diff --git a/engines/ags/lib/allegro/gfx.cpp b/engines/ags/lib/allegro/gfx.cpp
index 2b5d5ea2b00..3a4aa08e59e 100644
--- a/engines/ags/lib/allegro/gfx.cpp
+++ b/engines/ags/lib/allegro/gfx.cpp
@@ -234,6 +234,8 @@ void memory_putpixel(BITMAP *bmp, int x, int y, int color) {
 
 void putpixel(BITMAP *bmp, int x, int y, int color) {
 	Graphics::ManagedSurface &surf = **bmp;
+	if (x >= surf.w || y >= surf.h)
+		return;
 	void *p = surf.getBasePtr(x, y);
 
 	switch (surf.format.bytesPerPixel) {


Commit: e960e831b06ade19f3d075060a5c95866bbd784a
    https://github.com/scummvm/scummvm/commit/e960e831b06ade19f3d075060a5c95866bbd784a
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-06-20T23:52:25+01:00

Commit Message:
AGS: Remove unused variables for Allegro PACKFILE

This takes part of upstream d0405ac9e93f16bac9d849757df78bd10c82b556
that removes password and encryption support from PACKFILE in Allegro4.
We actually didn't have that code in ScummVM, but we still had some
(unused) related variables in the header file.

Changed paths:
    engines/ags/lib/allegro/file.h


diff --git a/engines/ags/lib/allegro/file.h b/engines/ags/lib/allegro/file.h
index 4d2138dc848..82b29f677a1 100644
--- a/engines/ags/lib/allegro/file.h
+++ b/engines/ags/lib/allegro/file.h
@@ -29,14 +29,8 @@ namespace AGS3 {
 
 #define F_READ          "r"
 #define F_WRITE         "w"
-#define F_READ_PACKED   "rp"
-#define F_WRITE_PACKED  "wp"
-#define F_WRITE_NOPACK  "w!"
 
 #define F_BUF_SIZE      4096           /* 4K buffer for caching data */
-#define F_PACK_MAGIC    0x736C6821L    /* magic number for packed files */
-#define F_NOPACK_MAGIC  0x736C682EL    /* magic number for autodetect */
-#define F_EXE_MAGIC     0x736C682BL    /* magic number for appended data */
 
 struct _al_normal_packfile_details {
 	int hndl;                           /* DOS file handle */
@@ -45,11 +39,7 @@ struct _al_normal_packfile_details {
 	int buf_size;                       /* number of bytes in the buffer */
 	long todo;                          /* number of bytes still on the disk */
 	struct PACKFILE *parent;            /* nested, parent file */
-	struct LZSS_PACK_DATA *pack_data;   /* for LZSS compression */
-	struct LZSS_UNPACK_DATA *unpack_data; /* for LZSS decompression */
 	char *filename;                     /* name of the file */
-	char *passdata;                     /* encryption key data */
-	char *passpos;                      /* current key position */
 	unsigned char buf[F_BUF_SIZE];      /* the actual data buffer */
 };
 


Commit: fe8083463992ad98dcdc7ddf00926a5fd29b9a8a
    https://github.com/scummvm/scummvm/commit/fe8083463992ad98dcdc7ddf00926a5fd29b9a8a
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-06-20T23:52:25+01:00

Commit Message:
AGS: Store DialogTopics in std::vector

>From upstream 2609c0d1ee43a4f997021ce48ca2a4f70ca1a6c7

Changed paths:
    engines/ags/engine/ac/dialog.h
    engines/ags/engine/ac/game.cpp
    engines/ags/engine/game/game_init.cpp
    engines/ags/engine/game/savegame_components.cpp
    engines/ags/engine/game/savegame_v321.cpp
    engines/ags/engine/main/game_file.cpp
    engines/ags/globals.cpp
    engines/ags/globals.h
    engines/ags/shared/game/main_game_file.cpp
    engines/ags/shared/game/main_game_file.h


diff --git a/engines/ags/engine/ac/dialog.h b/engines/ags/engine/ac/dialog.h
index e9bf5d9ff52..22c6ca656d5 100644
--- a/engines/ags/engine/ac/dialog.h
+++ b/engines/ags/engine/ac/dialog.h
@@ -23,6 +23,7 @@
 #define AGS_ENGINE_AC_DIALOG_H
 
 #include "ags/lib/std/vector.h"
+#include "ags/shared/ac/dialog_topic.h"
 #include "ags/engine/ac/dynobj/script_dialog.h"
 
 namespace AGS3 {
diff --git a/engines/ags/engine/ac/game.cpp b/engines/ags/engine/ac/game.cpp
index 33b153ada9e..261b5365e0e 100644
--- a/engines/ags/engine/ac/game.cpp
+++ b/engines/ags/engine/ac/game.cpp
@@ -26,7 +26,7 @@
 #include "ags/engine/ac/audio_channel.h"
 #include "ags/engine/ac/button.h"
 #include "ags/engine/ac/character.h"
-#include "ags/shared/ac/dialog_topic.h"
+#include "ags/engine/ac/dialog.h"
 #include "ags/engine/ac/draw.h"
 #include "ags/engine/ac/dynamic_sprite.h"
 #include "ags/engine/ac/event.h"
@@ -418,13 +418,11 @@ void unload_game_file() {
 		_G(curLipLine) = -1;
 	}
 
-	for (int i = 0; i < _GP(game).numdialog; ++i) {
-		if (_G(dialog)[i].optionscripts != nullptr)
-			free(_G(dialog)[i].optionscripts);
-		_G(dialog)[i].optionscripts = nullptr;
+	for (auto &dlg : _G(dialog)) {
+		if (dlg.optionscripts != nullptr)
+			free(dlg.optionscripts);
 	}
-	free(_G(dialog));
-	_G(dialog) = nullptr;
+	_G(dialog).clear();
 	delete[] _G(scrDialog);
 	_G(scrDialog) = nullptr;
 
diff --git a/engines/ags/engine/game/game_init.cpp b/engines/ags/engine/game/game_init.cpp
index 98c362f2495..8573b9281e1 100644
--- a/engines/ags/engine/game/game_init.cpp
+++ b/engines/ags/engine/game/game_init.cpp
@@ -363,6 +363,9 @@ HGameInitError InitGameState(const LoadedGameEntities &ents, GameDataVersion dat
 	_GP(views) = std::move(ents.Views);
 
 	_GP(play).charProps.resize(game.numcharacters);
+	_G(dialog) = std::move(ents.Dialogs);
+	_G(old_dialog_scripts) = std::move(ents.OldDialogScripts);
+	_G(old_speech_lines) = std::move(ents.OldSpeechLines);
 	_G(old_dialog_scripts) = ents.OldDialogScripts;
 	_G(old_speech_lines) = ents.OldSpeechLines;
 
diff --git a/engines/ags/engine/game/savegame_components.cpp b/engines/ags/engine/game/savegame_components.cpp
index 90df78e729b..50aa71e9f4e 100644
--- a/engines/ags/engine/game/savegame_components.cpp
+++ b/engines/ags/engine/game/savegame_components.cpp
@@ -23,7 +23,7 @@
 #include "ags/engine/game/savegame_components.h"
 #include "ags/shared/ac/audio_clip_type.h"
 #include "ags/shared/ac/common.h"
-#include "ags/shared/ac/dialog_topic.h"
+#include "ags/engine/ac/dialog.h"
 #include "ags/engine/ac/button.h"
 #include "ags/engine/ac/character.h"
 #include "ags/engine/ac/draw.h"
diff --git a/engines/ags/engine/game/savegame_v321.cpp b/engines/ags/engine/game/savegame_v321.cpp
index 5236b595a9e..5db0f0c1d51 100644
--- a/engines/ags/engine/game/savegame_v321.cpp
+++ b/engines/ags/engine/game/savegame_v321.cpp
@@ -32,7 +32,7 @@
 #include "ags/shared/core/types.h"
 #include "ags/engine/ac/character_extras.h"
 #include "ags/shared/ac/common.h"
-#include "ags/shared/ac/dialog_topic.h"
+#include "ags/engine/ac/dialog.h"
 #include "ags/engine/ac/button.h"
 #include "ags/engine/ac/dynamic_sprite.h"
 #include "ags/engine/ac/game.h"
diff --git a/engines/ags/engine/main/game_file.cpp b/engines/ags/engine/main/game_file.cpp
index adcd62429e9..5b158198c9c 100644
--- a/engines/ags/engine/main/game_file.cpp
+++ b/engines/ags/engine/main/game_file.cpp
@@ -169,7 +169,7 @@ HError LoadGameScripts(LoadedGameEntities &ents) {
 
 HError load_game_file() {
 	MainGameSource src;
-	LoadedGameEntities ents(_GP(game), _G(dialog));
+	LoadedGameEntities ents(_GP(game));
 	HError err = (HError)OpenMainGameFileFromDefaultAsset(src, _GP(AssetMgr).get());
 	if (err) {
 		err = (HError)ReadGameData(ents, src.InputStream.get(), src.DataVersion);
diff --git a/engines/ags/globals.cpp b/engines/ags/globals.cpp
index 73a1a66604a..8904d7f07a7 100644
--- a/engines/ags/globals.cpp
+++ b/engines/ags/globals.cpp
@@ -22,6 +22,7 @@
 #include "ags/globals.h"
 #include "ags/shared/ac/game_setup_struct.h"
 #include "ags/shared/ac/sprite_cache.h"
+#include "ags/shared/ac/dialog_topic.h"
 #include "ags/shared/core/asset_manager.h"
 #include "ags/shared/debugging/debug_manager.h"
 #include "ags/shared/font/fonts.h"
diff --git a/engines/ags/globals.h b/engines/ags/globals.h
index 75320606f92..f954f0b8939 100644
--- a/engines/ags/globals.h
+++ b/engines/ags/globals.h
@@ -523,7 +523,7 @@ public:
 	 * @{
 	 */
 
-	DialogTopic *_dialog = nullptr;
+	std::vector<DialogTopic> _dialog;
 	ScriptDialogOptionsRendering *_ccDialogOptionsRendering;
 	ScriptDrawingSurface *_dialogOptionsRenderingSurface = nullptr;
 
diff --git a/engines/ags/shared/game/main_game_file.cpp b/engines/ags/shared/game/main_game_file.cpp
index 77e11319957..c814c84c475 100644
--- a/engines/ags/shared/game/main_game_file.cpp
+++ b/engines/ags/shared/game/main_game_file.cpp
@@ -96,9 +96,8 @@ String GetMainGameFileErrorText(MainGameFileErrorType err) {
 	return "Unknown error.";
 }
 
-LoadedGameEntities::LoadedGameEntities(GameSetupStruct &game, DialogTopic *&dialogs)
+LoadedGameEntities::LoadedGameEntities(GameSetupStruct &game)
 	: Game(game)
-	, Dialogs(dialogs)
 	, SpriteCount(0) {
 }
 
@@ -266,14 +265,12 @@ void ReadViews(GameSetupStruct &game, std::vector<ViewStruct> &views, Stream *in
 	}
 }
 
-void ReadDialogs(DialogTopic *&dialog,
+void ReadDialogs(std::vector<DialogTopic> &dialog,
                  std::vector< std::shared_ptr<unsigned char> > &old_dialog_scripts,
                  std::vector<String> &old_dialog_src,
                  std::vector<String> &old_speech_lines,
                  Stream *in, GameDataVersion data_ver, int dlg_count) {
-	// TODO: I suspect +5 was a hacky way to "supress" memory access mistakes;
-	// double check and remove if proved unnecessary
-	dialog = (DialogTopic *)malloc(sizeof(DialogTopic) * dlg_count + 5);
+	dialog.resize(dlg_count);
 	for (int i = 0; i < dlg_count; ++i) {
 		dialog[i].ReadFromFile(in);
 	}
diff --git a/engines/ags/shared/game/main_game_file.h b/engines/ags/shared/game/main_game_file.h
index 8eca795ba66..3b8cc59742d 100644
--- a/engines/ags/shared/game/main_game_file.h
+++ b/engines/ags/shared/game/main_game_file.h
@@ -111,7 +111,7 @@ struct MainGameSource {
 // code refactoring.
 struct LoadedGameEntities {
 	GameSetupStruct &Game;
-	DialogTopic *&Dialogs;
+	std::vector<DialogTopic> Dialogs;
 	std::vector<ViewStruct> Views;
 	PScript                 GlobalScript;
 	PScript                 DialogScript;
@@ -131,7 +131,7 @@ struct LoadedGameEntities {
 	// speech texts displayed during dialog
 	std::vector<String>     OldSpeechLines;
 
-	LoadedGameEntities(GameSetupStruct &game, DialogTopic *&dialogs);
+	LoadedGameEntities(GameSetupStruct &game);
 	~LoadedGameEntities();
 };
 


Commit: 59643c70a1ce66c0c5f733b22bf9a86ca266a0f3
    https://github.com/scummvm/scummvm/commit/59643c70a1ce66c0c5f733b22bf9a86ca266a0f3
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2022-06-20T23:52:26+01:00

Commit Message:
AGS: Add new detection entry for Gemini Rue and Shardlight

Changed paths:
    engines/ags/detection_tables.h


diff --git a/engines/ags/detection_tables.h b/engines/ags/detection_tables.h
index 03643eedbcb..a7ad55afb25 100644
--- a/engines/ags/detection_tables.h
+++ b/engines/ags/detection_tables.h
@@ -3351,7 +3351,9 @@ const AGSGameDescription GAME_DESCRIPTIONS[] = {
 	GAME_ENTRY_GOG("geminirue", "gemini_rue_pc.exe", "f49a61ea46feb86f89de3c136ad809ff", 73412249),  // Win v1.03
 	GAME_ENTRY_GOG("geminirue", "gemini rue.exe", "5f747ea1c5f624d3716926fe1ca5135d", 73450387),  // Win v2.0
 	GAME_ENTRY_GOG("geminirue", "gemini rue.exe", "5f747ea1c5f624d3716926fe1ca5135d", 73486515),  // Win v2.1
+	GAME_ENTRY_GOG("geminirue", "gemini rue.exe", "5f747ea1c5f624d3716926fe1ca5135d", 73505075),  // Win v2.2
 	GAME_ENTRY_GOG("geminirue", "ac2game.dat", "056239de34dfa52cfe1b645eee4eacb7", 70356639), // Mac v2.1
+	GAME_ENTRY_GOG("geminirue", "ac2game.dat", "056239de34dfa52cfe1b645eee4eacb7", 70375199), // Mac v2.2
 	GAME_ENTRY_GOG("geminirue", "agsgame.dat", "f3c0c7d3892bdd8963e8ce017f73de08", 62069353), // Linux
 	GAME_ENTRY("geminirue", "gemini rue.exe", "0bdfb2139abaae5ae2dc85f1aacfd3f6", 61926695),
 	DETECTION_ENTRY("geminirue", "gemini rue.exe", "0bdfb2139abaae5ae2dc85f1aacfd3f6", 64650419, Common::DE_DEU, nullptr, nullptr, GAMEFLAG_FORCE_AA), // German retail
@@ -3455,6 +3457,7 @@ const AGSGameDescription GAME_DESCRIPTIONS[] = {
 	GAME_ENTRY_EN_STEAM("shardlight", "shardlight.exe", "cc447656f408ac32e8443274c3f70c67", 643459667),  // v2.0
 	GAME_ENTRY_EN_STEAM("shardlight", "shardlight.exe", "cc447656f408ac32e8443274c3f70c67", 643461648),  // v2.1
 	GAME_ENTRY_EN_GOG("shardlight", "ac2game.dat", "df94d3c1cec961c89894c676b000e7bc", 640346706), // Mac v2.3a
+	GAME_ENTRY_EN_GOG("shardlight", "ac2game.dat", "df94d3c1cec961c89894c676b000e7bc", 640348438), // Mac v2.4
 	GAME_ENTRY_EN("shardlight", "shardlight.exe", "ee801fba52d252249677a9170bd2db96", 642151325),
 	GAME_ENTRY_EN("shardlight", "shardlight.exe", "ee801fba52d252249677a9170bd2db96", 642142591),
 	GAME_ENTRY_EN("shivah", "shivah.exe", "6cddccb3744ec5c6af7c398fb7b3b11c", 19542815), // Official website




More information about the Scummvm-git-logs mailing list