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

bluegr noreply at scummvm.org
Mon Jun 19 19:01:36 UTC 2023


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

Summary:
0690f14871 AGS: Engine: ccInstance: do not assert stack if script was aborted
d74aa04fc3 AGS: Common: fixed GUIButton::IsImageButton() not accounting for neg values
fd8f0d0ef4 AGS: AlFont: fix accessing cached glyphs beyond the array range
f0216eafc0 AGS: Engine: fixed Character resetting frame after Move()
2b2fa06142 AGS: Inline some library functions + minor changes
a9edfcaae7 AGS: Updated build version (3.6.0.49)


Commit: 0690f148718c1042cc3d0224914c0836f010a75b
    https://github.com/scummvm/scummvm/commit/0690f148718c1042cc3d0224914c0836f010a75b
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-06-19T22:01:30+03:00

Commit Message:
AGS: Engine: ccInstance: do not assert stack if script was aborted

from upstream a55d76322fca302c0668e3ab76f0c122b22341d3

Changed paths:
    engines/ags/engine/script/cc_instance.cpp


diff --git a/engines/ags/engine/script/cc_instance.cpp b/engines/ags/engine/script/cc_instance.cpp
index 1b95a7aeba8..654ba1ed0dd 100644
--- a/engines/ags/engine/script/cc_instance.cpp
+++ b/engines/ags/engine/script/cc_instance.cpp
@@ -382,8 +382,8 @@ int ccInstance::CallScriptFunction(const char *funcname, int32_t numargs, const
 		return reterr;
 
 	// NOTE that if proper multithreading is added this will need
-	// to be reconsidered, since the GC could be run in the middle 
-	// of a RET from a function or something where there is an 
+	// to be reconsidered, since the GC could be run in the middle
+	// of a RET from a function or something where there is an
 	// object with ref count 0 that is in use
 	_GP(pool).RunGarbageCollectionIfAppropriate();
 
@@ -988,9 +988,11 @@ int ccInstance::Run(int32_t curpc) {
 
 			runningInst = wasRunning;
 
-			if (oldstack != registers[SREG_SP]) {
-				cc_error("stack corrupt after function call");
-				return -1;
+			if ((flags & INSTF_ABORTED) == 0) {
+				if (oldstack != registers[SREG_SP]) {
+					cc_error("stack corrupt after function call");
+					return -1;
+				}
 			}
 
 			next_call_needs_object = 0;


Commit: d74aa04fc35afd1f153e4177647ca4052c26823d
    https://github.com/scummvm/scummvm/commit/d74aa04fc35afd1f153e4177647ca4052c26823d
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-06-19T22:01:30+03:00

Commit Message:
AGS: Common: fixed GUIButton::IsImageButton() not accounting for neg values

from upstream c684713cc3f87e2a8d2c863955bf8293d00a2f7b

Changed paths:
    engines/ags/shared/gui/gui_button.cpp


diff --git a/engines/ags/shared/gui/gui_button.cpp b/engines/ags/shared/gui/gui_button.cpp
index 710c813f9de..f12cd37cf8f 100644
--- a/engines/ags/shared/gui/gui_button.cpp
+++ b/engines/ags/shared/gui/gui_button.cpp
@@ -92,7 +92,7 @@ const String &GUIButton::GetText() const {
 }
 
 bool GUIButton::IsImageButton() const {
-	return Image != 0;
+	return Image > 0;
 }
 
 bool GUIButton::IsClippingImage() const {
@@ -331,6 +331,7 @@ void GUIButton::WriteToSavegame(Stream *out) const {
 }
 
 void GUIButton::DrawImageButton(Bitmap *ds, int x, int y, bool draw_disabled) {
+	assert(CurrentImage >= 0);
 	// NOTE: the CLIP flag only clips the image, not the text
 	if (IsClippingImage() && !GUI::Options.ClipControls)
 		ds->SetClip(RectWH(x, y, Width, Height));


Commit: fd8f0d0ef4296c15a2a6b0e9abff3048bd891511
    https://github.com/scummvm/scummvm/commit/fd8f0d0ef4296c15a2a6b0e9abff3048bd891511
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-06-19T22:01:30+03:00

Commit Message:
AGS: AlFont: fix accessing cached glyphs beyond the array range

This fixes cases when the wanted glyph is not available in the Font.
Potentially fixes incorrect text render, and in the worst case - random memory corruptions.

Frankly, I have no idea how this was supposed to work, but it was like this in the imported alfont 2.0.9 sources, apparently.
from upstream 3f3a1df69f2a2af9805a1475215bc2b27eade569

Changed paths:
    engines/ags/lib/alfont/alfont.cpp


diff --git a/engines/ags/lib/alfont/alfont.cpp b/engines/ags/lib/alfont/alfont.cpp
index d980da69c51..baa113068fc 100644
--- a/engines/ags/lib/alfont/alfont.cpp
+++ b/engines/ags/lib/alfont/alfont.cpp
@@ -222,6 +222,8 @@ static void _alfont_uncache_glyphs(ALFONT_FONT *f) {
 
 
 static void _alfont_uncache_glyph_number(ALFONT_FONT *f, int glyph_number) {
+	if ((glyph_number < 0) || (glyph_number >= f->face->num_glyphs))
+		return;
 	if (f->cached_glyphs) {
 		if (f->cached_glyphs[glyph_number].is_cached) {
 			f->cached_glyphs[glyph_number].is_cached = 0;
@@ -248,6 +250,9 @@ static void _alfont_delete_glyphs(ALFONT_FONT *f) {
 
 
 static void _alfont_cache_glyph(ALFONT_FONT *f, int glyph_number) {
+	if ((glyph_number < 0) || (glyph_number >= f->face->num_glyphs))
+		return;
+
 	/* if glyph not cached yet */
 	if (!f->cached_glyphs[glyph_number].is_cached) {
 		FT_Glyph new_glyph;
@@ -1040,6 +1045,10 @@ void alfont_textout_aa_ex(BITMAP *bmp, ALFONT_FONT *f, const char *s, int x, int
 			else
 				glyph_index_tmp = character;
 
+			/* if out of existing glyph range -- skip it */
+			if ((glyph_index_tmp < 0) || (glyph_index_tmp >= f->face->num_glyphs))
+				continue;
+
 			/* cache the glyph */
 			_alfont_cache_glyph(f, glyph_index_tmp);
 			cglyph_tmp = f->cached_glyphs[glyph_index_tmp];
@@ -1078,6 +1087,10 @@ void alfont_textout_aa_ex(BITMAP *bmp, ALFONT_FONT *f, const char *s, int x, int
 		else
 			glyph_index = character;
 
+		/* if out of existing glyph range -- skip it */
+		if ((glyph_index < 0) || (glyph_index >= f->face->num_glyphs))
+			continue;
+
 		/* cache the glyph */
 		_alfont_cache_glyph(f, glyph_index);
 		if (f->fixed_width == TRUE)
@@ -2114,6 +2127,10 @@ void alfont_textout_ex(BITMAP * bmp, ALFONT_FONT * f, const char *s, int x, int
 			else
 				glyph_index_tmp = character;
 
+			/* if out of existing glyph range -- skip it */
+			if ((glyph_index_tmp < 0) || (glyph_index_tmp >= f->face->num_glyphs))
+				continue;
+
 			/* cache the glyph */
 			_alfont_cache_glyph(f, glyph_index_tmp);
 			cglyph_tmp = f->cached_glyphs[glyph_index_tmp];
@@ -2151,6 +2168,10 @@ void alfont_textout_ex(BITMAP * bmp, ALFONT_FONT * f, const char *s, int x, int
 		else
 			glyph_index = character;
 
+		/* if out of existing glyph range -- skip it */
+		if ((glyph_index < 0) || (glyph_index >= f->face->num_glyphs))
+			continue;
+
 		/* cache the glyph */
 		_alfont_cache_glyph(f, glyph_index);
 		if (f->fixed_width == TRUE)
@@ -2896,6 +2917,10 @@ int alfont_text_length(ALFONT_FONT * f, const char *str) {
 			else
 				glyph_index_tmp = character;
 
+			/* if out of existing glyph range -- skip it */
+			if ((glyph_index_tmp < 0) || (glyph_index_tmp >= f->face->num_glyphs))
+				continue;
+
 			/* cache the glyph */
 			_alfont_cache_glyph(f, glyph_index_tmp);
 			if (max_advancex < f->cached_glyphs[glyph_index_tmp].advancex)
@@ -2929,6 +2954,10 @@ int alfont_text_length(ALFONT_FONT * f, const char *str) {
 		}*/
 		last_glyph_index = glyph_index;
 
+		/* if out of existing glyph range -- skip it */
+		if ((glyph_index < 0) || (glyph_index >= f->face->num_glyphs))
+			continue;
+
 		/* cache */
 		_alfont_cache_glyph(f, glyph_index);
 		if (f->fixed_width == TRUE)
@@ -3008,6 +3037,10 @@ int alfont_char_length(ALFONT_FONT * f, int character) {
 	}*/
 	last_glyph_index = glyph_index;
 
+	/* if out of existing glyph range -- imagine empty char */
+	if ((glyph_index < 0) || (glyph_index >= f->face->num_glyphs))
+		return 0;
+
 	if (f->fixed_width == TRUE) {
 		_alfont_uncache_glyph_number(f, glyph_index);
 	}
@@ -4137,7 +4170,7 @@ int alfont_ugetxc(ALFONT_FONT * f, const char **s) {
 	return character;
 }
 
-// Following function alfont_get_string is removed from compilation because it 
+// Following function alfont_get_string is removed from compilation because it
 // is implemented with the use of non-standart malloc_usable_size function
 // (defined as _msize). This may cause linking errors on some Linux systems or
 // if using particular compilers.


Commit: f0216eafc0fc123c17fd2650bed3c4ae5dd0ef12
    https://github.com/scummvm/scummvm/commit/f0216eafc0fc123c17fd2650bed3c4ae5dd0ef12
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-06-19T22:01:30+03:00

Commit Message:
AGS: Engine: fixed Character resetting frame after Move()

Unlike Walk(), Move() is not supposed to animate character, or change frames.
>From upstream 5e06350dece778db5e3007596ad2bb6272d7315d

Changed paths:
    engines/ags/engine/ac/character_info_engine.cpp


diff --git a/engines/ags/engine/ac/character_info_engine.cpp b/engines/ags/engine/ac/character_info_engine.cpp
index e201c74422b..1b82c201a97 100644
--- a/engines/ags/engine/ac/character_info_engine.cpp
+++ b/engines/ags/engine/ac/character_info_engine.cpp
@@ -227,11 +227,13 @@ void CharacterInfo::update_character_moving(int &char_index, CharacterExtras *ch
 			chex->process_idle_this_time = 1;
 			doing_nothing = 1;
 			walkwait = 0;
-			chex->animwait = 0;
-			// use standing pic
 			Character_StopMoving(this);
-			frame = 0;
-			CheckViewFrameForCharacter(this);
+			if ((flags & CHF_MOVENOTWALK) == 0) {
+				// use standing pic
+				chex->animwait = 0;
+				frame = 0;
+				CheckViewFrameForCharacter(this);
+			}
 		} else if (chex->animwait > 0) chex->animwait--;
 		else {
 			if (flags & CHF_ANTIGLIDE)


Commit: 2b2fa0614241704f97ade5efe4c8b4bc2e7c82e5
    https://github.com/scummvm/scummvm/commit/2b2fa0614241704f97ade5efe4c8b4bc2e7c82e5
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-06-19T22:01:30+03:00

Commit Message:
AGS: Inline some library functions + minor changes

This is the only relevant part of upstream commit
a46b97fc3bf7fdff82b84a863a3c0cacc37e7a2b
"Engine: explicitly search for plugins in a game's data dir too"

(ScummVM does not support external plugins)

Changed paths:
    engines/ags/engine/util/library.h
    engines/ags/engine/util/library_scummvm.h
    engines/ags/plugins/ags_plugin.cpp


diff --git a/engines/ags/engine/util/library.h b/engines/ags/engine/util/library.h
index e36147e217c..3d68b716e42 100644
--- a/engines/ags/engine/util/library.h
+++ b/engines/ags/engine/util/library.h
@@ -37,16 +37,27 @@ public:
 
 	virtual ~BaseLibrary() {}
 
-	String GetName() const { return _name; }
-	String GetFilePath() const { return _path; }
+	// Get library name; returns empty string if not loaded
+	inline String GetName() const { return _name; }
+	// Get actual filename; returns empty string if not loaded
+	inline String GetFileName() const { return _filename; }
+	// Get path used to load the library; or empty string is not loaded.
+	// NOTE: this is NOT a fully qualified path, but a lookup path.
+	inline String GetPath() const { return _path; }
 
+	// Returns expected filename form for the dynamic library of a given name
 	virtual String GetFilenameForLib(const String &libname) = 0;
+
+	// Try load a library of a given name
 	virtual bool Load(const String &libname) = 0;
+	// Unload a library; does nothing if was not loaded
 	virtual void Unload() = 0;
+	// Tells if library is loaded
 	virtual bool IsLoaded() const = 0;
 
 protected:
 	String _name;
+	String _filename;
 	String _path;
 };
 
diff --git a/engines/ags/engine/util/library_scummvm.h b/engines/ags/engine/util/library_scummvm.h
index 7c0f37665df..5baf671105b 100644
--- a/engines/ags/engine/util/library_scummvm.h
+++ b/engines/ags/engine/util/library_scummvm.h
@@ -58,7 +58,8 @@ public:
 		if (_library == nullptr)
 			return false;
 		_name = libraryName;
-		_path = GetFilenameForLib(libraryName);;
+		_filename = GetFilenameForLib(libraryName);
+		_path = "./";
 		return true;
 	}
 
@@ -67,6 +68,7 @@ public:
 			Plugins::pluginClose(_library);
 			_library = nullptr;
 			_name = "";
+			_filename = "";
 			_path = "";
 		}
 	}
diff --git a/engines/ags/plugins/ags_plugin.cpp b/engines/ags/plugins/ags_plugin.cpp
index c570d59bb58..569f48e1f1c 100644
--- a/engines/ags/plugins/ags_plugin.cpp
+++ b/engines/ags/plugins/ags_plugin.cpp
@@ -843,7 +843,7 @@ void pl_run_plugin_init_gfx_hooks(const char *driverName, void *data) {
 	}
 }
 
-Engine::GameInitError pl_register_plugins(const std::vector<Shared::PluginInfo> &infos) {
+Engine::GameInitError pl_register_plugins(const std::vector<PluginInfo> &infos) {
 	_GP(plugins).clear();
 	_GP(plugins).reserve(MAXPLUGINS);
 


Commit: a9edfcaae7ad6533a171c77cc806b7c15c6091e4
    https://github.com/scummvm/scummvm/commit/a9edfcaae7ad6533a171c77cc806b7c15c6091e4
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-06-19T22:01:30+03:00

Commit Message:
AGS: Updated build version (3.6.0.49)

Partially from upstream b5f3bb1ed063cba192f8f11e3c8a0c54b3dd9bbd

Changed paths:
    engines/ags/shared/core/def_version.h


diff --git a/engines/ags/shared/core/def_version.h b/engines/ags/shared/core/def_version.h
index 09d8f22de57..80eb76cba17 100644
--- a/engines/ags/shared/core/def_version.h
+++ b/engines/ags/shared/core/def_version.h
@@ -22,9 +22,9 @@
 #ifndef AGS_SHARED_CORE_DEFVERSION_H
 #define AGS_SHARED_CORE_DEFVERSION_H
 
-#define ACI_VERSION_STR      "3.6.0.48"
+#define ACI_VERSION_STR      "3.6.0.49"
 #if defined (RC_INVOKED) // for MSVC resource compiler
-#define ACI_VERSION_MSRC_DEF  3.6.0.48
+#define ACI_VERSION_MSRC_DEF  3.6.0.49
 #endif
 
 #define SPECIAL_VERSION ""




More information about the Scummvm-git-logs mailing list