[Scummvm-git-logs] scummvm master -> d42e55212cb49a21269eb3ae5c4073406381fe44
tag2015
noreply at scummvm.org
Wed Jan 17 02:13:22 UTC 2024
This automated email contains information about 21 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
95b0b2fc4d AGS: Engine: when drawing TextWindow clip border pieces, fix over corners
6f4b702810 AGS: Common: small fix to the OpenMainGameFile's error msg
b395603107 AGS: Engine: print which gfx driver is set to the log
bcf5ebaae5 AGS: Common: account Font's YOffset when calculating GUI's graphical rect
8aa46edc16 AGS: Common: account for Font's height when calculating ListBox and TextBox
0f39d8c525 AGS: Common: small fix for GUITextBox::CalcGraphicRect()
e2d455ee9e AGS: Updated build version (3.6.0.54)
a7266499a5 AGS: Engine: misspelling fix: perfomance->performance
4e6d475e17 AGS: Engine: fixed gamename label not updating if Game.Name changes
4eaac90e4e AGS: Common: safer reading of fixed-len string fields
cce6aff754 AGS: Engine: replaced uses of strncpy with snprintf for safety
d18f7cac25 AGS: Engine: replaced another case of strncpy with snprintf
46b14a21c6 AGS: Engine: safety check for fixups with out of range code reference
7e003f30e9 AGS: Engine: allow old-style resolution upscale for kGameResolution_Default
30fc1a911d AGS: Engine: fixed System.ColorDepth to returning game's native depth
de715bab92 AGS: Engine: fixed uses of scsystem.color_depth
2c35d26b82 AGS: Updated build version (3.6.0.55)
7a281232f6 AGS: Remove leftover lines breaking save/load
a660cd67a4 AGS: Engine: fixed bytecode fixup assertion done for unapplicable case
d1d5d2ed7d AGS: Updated build version (3.6.0.56)
d42e55212c AGS: Return more meaningful message in GetDriverName
Commit: 95b0b2fc4dbabcaf3e6ec2b8b2855967db1c92d6
https://github.com/scummvm/scummvm/commit/95b0b2fc4dbabcaf3e6ec2b8b2855967db1c92d6
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2024-01-17T03:12:27+01:00
Commit Message:
AGS: Engine: when drawing TextWindow clip border pieces, fix over corners
This fixes vertical or horizontal borders to be drawn under rightmost and bottom
corners, which may have transparent parts.
>From upstream a77393abc2353a7d8309b7edf1f0ff582c34778c
Changed paths:
engines/ags/engine/ac/display.cpp
diff --git a/engines/ags/engine/ac/display.cpp b/engines/ags/engine/ac/display.cpp
index 62deb6dc712..8f970b2ed43 100644
--- a/engines/ags/engine/ac/display.cpp
+++ b/engines/ags/engine/ac/display.cpp
@@ -634,8 +634,9 @@ void draw_button_background(Bitmap *ds, int xx1, int yy1, int xx2, int yy2, GUIM
if (iep->BgColor > 0)
ds->FillRect(Rect(xx1, yy1, xx2, yy2), draw_color);
- int leftRightWidth = _GP(game).SpriteInfos[get_but_pic(iep, 4)].Width;
- int topBottomHeight = _GP(game).SpriteInfos[get_but_pic(iep, 6)].Height;
+ const int leftRightWidth = _GP(game).SpriteInfos[get_but_pic(iep, 4)].Width;
+ const int topBottomHeight = _GP(game).SpriteInfos[get_but_pic(iep, 6)].Height;
+ // GUI middle space
if (iep->BgImage > 0) {
if ((_G(loaded_game_file_version) <= kGameVersion_272) // 2.xx
&& (_GP(spriteset)[iep->BgImage]->GetWidth() == 1)
@@ -664,19 +665,24 @@ void draw_button_background(Bitmap *ds, int xx1, int yy1, int xx2, int yy2, GUIM
ds->ResetClip();
}
}
- int uu;
- for (uu = yy1; uu <= yy2; uu += _GP(game).SpriteInfos[get_but_pic(iep, 4)].Height) {
- do_corner(ds, get_but_pic(iep, 4), xx1, uu, -1, 0); // left side
- do_corner(ds, get_but_pic(iep, 5), xx2 + 1, uu, 0, 0); // right side
+ // Vertical borders
+ ds->SetClip(Rect(xx1 - leftRightWidth, yy1, xx2 + 1 + leftRightWidth, yy2));
+ for (int uu = yy1; uu <= yy2; uu += _GP(game).SpriteInfos[get_but_pic(iep, 4)].Height) {
+ do_corner(ds, get_but_pic(iep, 4), xx1, uu, -1, 0); // left side
+ do_corner(ds, get_but_pic(iep, 5), xx2 + 1, uu, 0, 0); // right side
}
- for (uu = xx1; uu <= xx2; uu += _GP(game).SpriteInfos[get_but_pic(iep, 6)].Width) {
- do_corner(ds, get_but_pic(iep, 6), uu, yy1, 0, -1); // top side
+ // Horizontal borders
+ ds->SetClip(Rect(xx1, yy1 - topBottomHeight, xx2, yy2 + 1 + topBottomHeight));
+ for (int uu = xx1; uu <= xx2; uu += _GP(game).SpriteInfos[get_but_pic(iep, 6)].Width) {
+ do_corner(ds, get_but_pic(iep, 6), uu, yy1, 0, -1); // top side
do_corner(ds, get_but_pic(iep, 7), uu, yy2 + 1, 0, 0); // bottom side
}
- do_corner(ds, get_but_pic(iep, 0), xx1, yy1, -1, -1); // top left
- do_corner(ds, get_but_pic(iep, 1), xx1, yy2 + 1, -1, 0); // bottom left
- do_corner(ds, get_but_pic(iep, 2), xx2 + 1, yy1, 0, -1); // top right
- do_corner(ds, get_but_pic(iep, 3), xx2 + 1, yy2 + 1, 0, 0); // bottom right
+ ds->ResetClip();
+ // Four corners
+ do_corner(ds, get_but_pic(iep, 0), xx1, yy1, -1, -1); // top left
+ do_corner(ds, get_but_pic(iep, 1), xx1, yy2 + 1, -1, 0); // bottom left
+ do_corner(ds, get_but_pic(iep, 2), xx2 + 1, yy1, 0, -1); // top right
+ do_corner(ds, get_but_pic(iep, 3), xx2 + 1, yy2 + 1, 0, 0); // bottom right
}
}
Commit: 6f4b7028104c99dfa4344c69492ef56eeb901219
https://github.com/scummvm/scummvm/commit/6f4b7028104c99dfa4344c69492ef56eeb901219
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2024-01-17T03:12:28+01:00
Commit Message:
AGS: Common: small fix to the OpenMainGameFile's error msg
from upstream d297b2d76a1b98a8fd3bb6bcdb752e0286c11db7
Changed paths:
engines/ags/shared/game/main_game_file.cpp
diff --git a/engines/ags/shared/game/main_game_file.cpp b/engines/ags/shared/game/main_game_file.cpp
index 01ed8390957..640af3b0eb5 100644
--- a/engines/ags/shared/game/main_game_file.cpp
+++ b/engines/ags/shared/game/main_game_file.cpp
@@ -192,7 +192,7 @@ HGameFileError OpenMainGameFile(const String &filename, MainGameSource &src) {
// Try to open given file
Stream *in = File::OpenFileRead(filename);
if (!in)
- return new MainGameFileError(kMGFErr_FileOpenFailed, String::FromFormat("Filename: %s.", filename.GetCStr()));
+ return new MainGameFileError(kMGFErr_FileOpenFailed, String::FromFormat("Tried filename: %s.", filename.GetCStr()));
src.Filename = filename;
src.InputStream.reset(in);
return OpenMainGameFileBase(in, src);
@@ -209,7 +209,8 @@ HGameFileError OpenMainGameFileFromDefaultAsset(MainGameSource &src, AssetManage
in = mgr->OpenAsset(filename);
}
if (!in)
- return new MainGameFileError(kMGFErr_FileOpenFailed, String::FromFormat("Filename: %s.", filename.GetCStr()));
+ return new MainGameFileError(kMGFErr_FileOpenFailed,
+ String::FromFormat("Tried filenames: %s, %s.", MainGameSource::DefaultFilename_v3, MainGameSource::DefaultFilename_v2));
src.Filename = filename;
src.InputStream.reset(in);
return OpenMainGameFileBase(in, src);
Commit: b3956031074dcaec6e9938e3e6a3a2f6b4df2224
https://github.com/scummvm/scummvm/commit/b3956031074dcaec6e9938e3e6a3a2f6b4df2224
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2024-01-17T03:12:28+01:00
Commit Message:
AGS: Engine: print which gfx driver is set to the log
Partially from upstream f58f9634422ae28f54d1fd9dc6112c62ad283597
Changed paths:
engines/ags/engine/gfx/ali_3d_scummvm.h
engines/ags/engine/gfx/graphics_driver.h
engines/ags/engine/main/graphics_mode.cpp
diff --git a/engines/ags/engine/gfx/ali_3d_scummvm.h b/engines/ags/engine/gfx/ali_3d_scummvm.h
index eee01388e85..e9516d3e119 100644
--- a/engines/ags/engine/gfx/ali_3d_scummvm.h
+++ b/engines/ags/engine/gfx/ali_3d_scummvm.h
@@ -160,12 +160,13 @@ public:
ScummVMRendererGraphicsDriver();
~ScummVMRendererGraphicsDriver() override;
- const char *GetDriverName() override {
- return "SDL 2D Software renderer";
- }
const char *GetDriverID() override {
return "Software";
}
+ const char *GetDriverName() override {
+ return "SDL 2D Software renderer";
+ }
+
void SetTintMethod(TintMethod /*method*/) override;
bool SetDisplayMode(const DisplayMode &mode) override;
void UpdateDeviceScreen(const Size &screen_sz) override;
diff --git a/engines/ags/engine/gfx/graphics_driver.h b/engines/ags/engine/gfx/graphics_driver.h
index c47f4bb119f..2ace2665e92 100644
--- a/engines/ags/engine/gfx/graphics_driver.h
+++ b/engines/ags/engine/gfx/graphics_driver.h
@@ -97,8 +97,10 @@ typedef void (*GFXDRV_CLIENTCALLBACKINITGFX)(void *data);
class IGraphicsDriver {
public:
- virtual const char *GetDriverName() = 0;
+ // Gets graphic driver's identifier
virtual const char *GetDriverID() = 0;
+ // Gets graphic driver's "friendly name"
+ virtual const char *GetDriverName() = 0;
virtual void SetTintMethod(TintMethod method) = 0;
// Initialize given display mode
virtual bool SetDisplayMode(const DisplayMode &mode) = 0;
diff --git a/engines/ags/engine/main/graphics_mode.cpp b/engines/ags/engine/main/graphics_mode.cpp
index 3c95e533ef7..e30326ca9c1 100644
--- a/engines/ags/engine/main/graphics_mode.cpp
+++ b/engines/ags/engine/main/graphics_mode.cpp
@@ -470,6 +470,7 @@ bool graphics_mode_set_dm(const DisplayMode &dm) {
_GP(SavedWindowedSetting).Dm = rdm;
else
_GP(SavedFullscreenSetting).Dm = rdm;
+ Debug::Printf(kDbgMsg_Info, "Graphics driver set: %s", _G(gfxDriver)->GetDriverName());
Debug::Printf(kDbgMsg_Info, "Graphics mode set: %d x %d (%d-bit) %s",
rdm.Width, rdm.Height, rdm.ColorDepth,
rdm.IsWindowed() ? "windowed" : (rdm.IsRealFullscreen() ? "fullscreen" : "fullscreen desktop"));
Commit: bcf5ebaae583deb153203133042de6f10bb6c81b
https://github.com/scummvm/scummvm/commit/bcf5ebaae583deb153203133042de6f10bb6c81b
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2024-01-17T03:12:28+01:00
Commit Message:
AGS: Common: account Font's YOffset when calculating GUI's graphical rect
This fixes fonts with a custom VerticalOffset set getting unexpectedly clipped by a control's texture. Fixes Button and Label controls.
>From upstream 02b15886d09b1025ac051bc8adfd6c3e5e7cd171
Changed paths:
engines/ags/shared/gui/gui_button.cpp
engines/ags/shared/gui/gui_label.cpp
engines/ags/shared/gui/gui_main.cpp
engines/ags/shared/gui/gui_main.h
diff --git a/engines/ags/shared/gui/gui_button.cpp b/engines/ags/shared/gui/gui_button.cpp
index 8185a464e4b..ec34468ede7 100644
--- a/engines/ags/shared/gui/gui_button.cpp
+++ b/engines/ags/shared/gui/gui_button.cpp
@@ -106,6 +106,7 @@ GUIButtonPlaceholder GUIButton::GetPlaceholder() const {
Rect GUIButton::CalcGraphicRect(bool clipped) {
if (clipped)
return RectWH(0, 0, Width, Height);
+
// TODO: need to find a way to cache image and text position, or there'll be some repetition
Rect rc = RectWH(0, 0, Width, Height);
if (IsImageButton()) {
@@ -140,7 +141,7 @@ Rect GUIButton::CalcGraphicRect(bool clipped) {
frame.Left++;
frame.Top++;
}
- rc = SumRects(rc, GUI::CalcTextPosition(_textToDraw.GetCStr(), Font, frame, TextAlignment));
+ rc = SumRects(rc, GUI::CalcTextGraphicalRect(_textToDraw.GetCStr(), Font, frame, TextAlignment));
}
return rc;
}
diff --git a/engines/ags/shared/gui/gui_label.cpp b/engines/ags/shared/gui/gui_label.cpp
index 02fc4801bf9..18297ff4974 100644
--- a/engines/ags/shared/gui/gui_label.cpp
+++ b/engines/ags/shared/gui/gui_label.cpp
@@ -56,6 +56,7 @@ GUILabelMacro GUILabel::GetTextMacros() const {
Rect GUILabel::CalcGraphicRect(bool clipped) {
if (clipped)
return RectWH(0, 0, Width, Height);
+
// TODO: need to find a way to text position, or there'll be some repetition
// have to precache text and size on some events:
// - translation change
@@ -79,7 +80,11 @@ Rect GUILabel::CalcGraphicRect(bool clipped) {
(FrameAlignment)TextAlignment);
max_line.X2 = MAX(max_line.X2, lpos.X2);
}
- return SumRects(rc, RectWH(0, 0, max_line.X2 - max_line.X1 + 1, at_y - linespacing + get_font_surface_height(Font)));
+ // Include font fixes for the first and last text line,
+ // in case graphical height is different, and there's a VerticalOffset
+ Line vextent = GUI::CalcFontGraphicalVExtent(Font);
+ Rect text_rc = RectWH(0, vextent.Y1, max_line.X2 - max_line.X1 + 1, at_y - linespacing + (vextent.Y2 - vextent.Y1));
+ return SumRects(rc, text_rc);
}
void GUILabel::Draw(Bitmap *ds, int x, int y) {
diff --git a/engines/ags/shared/gui/gui_main.cpp b/engines/ags/shared/gui/gui_main.cpp
index 44217c0cc44..c6fccb3ba20 100644
--- a/engines/ags/shared/gui/gui_main.cpp
+++ b/engines/ags/shared/gui/gui_main.cpp
@@ -656,13 +656,28 @@ namespace GUI {
GuiVersion GameGuiVersion = kGuiVersion_Initial;
-Rect CalcTextPosition(const char *text, int font, const Rect &frame, FrameAlignment align) {
+Line CalcFontGraphicalVExtent(int font) {
+ // Following factors are affecting the graphical vertical metrics:
+ // * custom vertical offset set by user (if non-zero),
+ // * font's real graphical height
+ int font_yoffset = get_fontinfo(font).YOffset;
+ int yoff = std::min(0, font_yoffset); // only if yoff is negative
+ int height_off = std::max(0, font_yoffset); // only if yoff is positive
+ return Line(0, yoff, 0, get_font_surface_height(font) + height_off);
+}
+
+Point CalcTextPosition(const char *text, int font, const Rect &frame, FrameAlignment align, Rect *gr_rect) {
+ // When aligning we use the formal font's height, which in practice may not be
+ // its real graphical height (this is because of historical AGS's font behavior)
int use_height = (_G(loaded_game_file_version) < kGameVersion_360_21) ?
get_font_height(font) + ((align & kMAlignVCenter) ? 1 : 0) :
get_font_height_outlined(font);
Rect rc = AlignInRect(frame, RectWH(0, 0, get_text_width_outlined(text, font), use_height), align);
- rc.SetHeight(get_font_surface_height(font));
- return rc;
+ if (gr_rect) {
+ Line vextent = CalcFontGraphicalVExtent(font);
+ *gr_rect = RectWH(rc.Left, rc.Top + vextent.Y1, rc.GetWidth(), vextent.Y2 - vextent.Y1);
+ }
+ return rc.GetLT();
}
Line CalcTextPositionHor(const char *text, int font, int x1, int x2, int y, FrameAlignment align) {
@@ -671,6 +686,19 @@ Line CalcTextPositionHor(const char *text, int font, int x1, int x2, int y, Fram
return Line(x, y, x + w - 1, y);
}
+Rect CalcTextGraphicalRect(const char *text, int font, const Point &at) {
+ // Calc only width, and let CalcFontGraphicalVExtent() calc height
+ int w = get_text_width_outlined(text, font);
+ Line vextent = CalcFontGraphicalVExtent(font);
+ return RectWH(at.X, at.Y + vextent.Y1, w, vextent.Y2 - vextent.Y1);
+}
+
+Rect CalcTextGraphicalRect(const char *text, int font, const Rect &frame, FrameAlignment align) {
+ Rect gr_rect;
+ CalcTextPosition(text, font, frame, align, &gr_rect);
+ return gr_rect;
+}
+
void DrawDisabledEffect(Bitmap *ds, const Rect &rc) {
color_t draw_color = ds->GetCompatibleColor(8);
for (int at_x = rc.Left; at_x <= rc.Right; ++at_x) {
@@ -681,8 +709,8 @@ void DrawDisabledEffect(Bitmap *ds, const Rect &rc) {
}
void DrawTextAligned(Bitmap *ds, const char *text, int font, color_t text_color, const Rect &frame, FrameAlignment align) {
- Rect item = CalcTextPosition(text, font, frame, align);
- wouttext_outline(ds, item.Left, item.Top, font, text_color, text);
+ Point pos = CalcTextPosition(text, font, frame, align);
+ wouttext_outline(ds, pos.X, pos.Y, font, text_color, text);
}
void DrawTextAlignedHor(Bitmap *ds, const char *text, int font, color_t text_color, int x1, int x2, int y, FrameAlignment align) {
diff --git a/engines/ags/shared/gui/gui_main.h b/engines/ags/shared/gui/gui_main.h
index 1fd189a5a12..1d5fee677e6 100644
--- a/engines/ags/shared/gui/gui_main.h
+++ b/engines/ags/shared/gui/gui_main.h
@@ -218,10 +218,22 @@ namespace GUI {
extern GuiVersion GameGuiVersion;
extern GuiOptions Options;
-// Calculates the text's graphical position, given the alignment
-Rect CalcTextPosition(const char *text, int font, const Rect &frame, FrameAlignment align);
-// Calculates the text's graphical position, given the horizontal alignment
+// Calculates the text's draw position, given the alignment
+// optionally returns the real graphical rect that the text would occupy
+Point CalcTextPosition(const char *text, int font, const Rect &frame, FrameAlignment align, Rect *gr_rect = nullptr);
+// Calculates the text's draw position and horizontal extent,
+// using strictly horizontal alignment
Line CalcTextPositionHor(const char *text, int font, int x1, int x2, int y, FrameAlignment align);
+// Calculates the graphical rect that the text would occupy
+// if drawn at the given coordinates
+Rect CalcTextGraphicalRect(const char *text, int font, const Point &at);
+// Calculates the graphical rect that the text would occupy
+// if drawn aligned to the given frame
+Rect CalcTextGraphicalRect(const char *text, int font, const Rect &frame, FrameAlignment align);
+// Calculates a vertical graphical extent for a given font,
+// which is a top and bottom offsets in zero-based coordinates.
+// NOTE: this applies font size fixups.
+Line CalcFontGraphicalVExtent(int font);
// Draw standart "shading" effect over rectangle
void DrawDisabledEffect(Bitmap *ds, const Rect &rc);
// Draw text aligned inside rectangle
Commit: 8aa46edc16a749255c3041e7f17a5b38e333568f
https://github.com/scummvm/scummvm/commit/8aa46edc16a749255c3041e7f17a5b38e333568f
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2024-01-17T03:12:28+01:00
Commit Message:
AGS: Common: account for Font's height when calculating ListBox and TextBox
Historically these controls could draw text beyond their vertical bounds too (in non-clipping mode).
>From upstream c9572541a6f8d38ed2ca1ba7af8e235c5d56c8f2
Changed paths:
engines/ags/engine/gui/gui_engine.cpp
engines/ags/shared/gui/gui_listbox.cpp
engines/ags/shared/gui/gui_textbox.cpp
engines/ags/shared/gui/gui_textbox.h
diff --git a/engines/ags/engine/gui/gui_engine.cpp b/engines/ags/engine/gui/gui_engine.cpp
index 3363a82079b..f41b130feee 100644
--- a/engines/ags/engine/gui/gui_engine.cpp
+++ b/engines/ags/engine/gui/gui_engine.cpp
@@ -132,7 +132,7 @@ void GUITextBox::DrawTextBoxContents(Bitmap *ds, int x, int y, color_t text_colo
wouttext_outline(ds, x + 1 + get_fixed_pixel_size(1), y + 1 + get_fixed_pixel_size(1), Font, text_color, Text.GetCStr());
if (IsGUIEnabled(this)) {
// draw a cursor
- int draw_at_x = get_text_width(Text.GetCStr(), Font) + x + 3;
+ int draw_at_x = x + get_text_width(Text.GetCStr(), Font) + 3;
int draw_at_y = y + 1 + get_font_height(Font);
ds->DrawRect(Rect(draw_at_x, draw_at_y, draw_at_x + get_fixed_pixel_size(5), draw_at_y + (get_fixed_pixel_size(1) - 1)), text_color);
}
diff --git a/engines/ags/shared/gui/gui_listbox.cpp b/engines/ags/shared/gui/gui_listbox.cpp
index 31b2a5427e3..bb4f629bf6c 100644
--- a/engines/ags/shared/gui/gui_listbox.cpp
+++ b/engines/ags/shared/gui/gui_listbox.cpp
@@ -84,6 +84,7 @@ bool GUIListBox::IsInRightMargin(int x) const {
Rect GUIListBox::CalcGraphicRect(bool clipped) {
if (clipped)
return RectWH(0, 0, Width, Height);
+
// TODO: need to find a way to text position, or there'll be some repetition
// have to precache text and size on some events:
// - translation change
@@ -105,7 +106,12 @@ Rect GUIListBox::CalcGraphicRect(bool clipped) {
(FrameAlignment)TextAlignment);
max_line.X2 = MAX(max_line.X2, lpos.X2);
}
- return SumRects(rc, RectWH(0, 0, max_line.X2 - max_line.X1 + 1, Height));
+ int last_line_y = pixel_size + 1 + (VisibleItemCount - 1) * RowHeight;
+ // Include font fixes for the first and last text line,
+ // in case graphical height is different, and there's a VerticalOffset
+ Line vextent = GUI::CalcFontGraphicalVExtent(Font);
+ Rect text_rc = RectWH(0, vextent.Y1, max_line.X2 - max_line.X1 + 1, last_line_y + (vextent.Y2 - vextent.Y1));
+ return SumRects(rc, text_rc);
}
int GUIListBox::AddItem(const String &text) {
diff --git a/engines/ags/shared/gui/gui_textbox.cpp b/engines/ags/shared/gui/gui_textbox.cpp
index 137c2261be7..b45cbeca29b 100644
--- a/engines/ags/shared/gui/gui_textbox.cpp
+++ b/engines/ags/shared/gui/gui_textbox.cpp
@@ -51,6 +51,26 @@ bool GUITextBox::IsBorderShown() const {
return (TextBoxFlags & kTextBox_ShowBorder) != 0;
}
+Rect GUITextBox::CalcGraphicRect(bool clipped) {
+ if (clipped)
+ return RectWH(0, 0, Width, Height);
+
+ // TODO: need to find a way to cache text position, or there'll be some repetition
+ Rect rc = RectWH(0, 0, Width, Height);
+ Point text_at(1 + get_fixed_pixel_size(1), 1 + get_fixed_pixel_size(1));
+ Rect text_rc = GUI::CalcTextGraphicalRect(Text.GetCStr(), Font, text_at);
+ if (IsGUIEnabled(this)) {
+ // add a cursor
+ Rect cur_rc = RectWH(
+ get_text_width(Text.GetCStr(), Font) + 3,
+ 1 + get_font_height(Font),
+ get_fixed_pixel_size(5),
+ get_fixed_pixel_size(1) - 1);
+ text_rc = SumRects(text_rc, cur_rc);
+ }
+ return SumRects(rc, text_rc);
+}
+
void GUITextBox::Draw(Bitmap *ds, int x, int y) {
color_t text_color = ds->GetCompatibleColor(TextColor);
color_t draw_color = ds->GetCompatibleColor(TextColor);
diff --git a/engines/ags/shared/gui/gui_textbox.h b/engines/ags/shared/gui/gui_textbox.h
index ed285651847..9490a25e0a9 100644
--- a/engines/ags/shared/gui/gui_textbox.h
+++ b/engines/ags/shared/gui/gui_textbox.h
@@ -38,6 +38,7 @@ public:
bool IsBorderShown() const;
// Operations
+ Rect CalcGraphicRect(bool clipped) override;
void Draw(Bitmap *ds, int x = 0, int y = 0) override;
void SetShowBorder(bool on);
Commit: 0f39d8c525e2bb3666f03afa5e9619bee89be632
https://github.com/scummvm/scummvm/commit/0f39d8c525e2bb3666f03afa5e9619bee89be632
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2024-01-17T03:12:29+01:00
Commit Message:
AGS: Common: small fix for GUITextBox::CalcGraphicRect()
>From upstream 3529f4b2e5e41c6662abc9e2ec07e4113605137e
Changed paths:
engines/ags/shared/gui/gui_textbox.cpp
diff --git a/engines/ags/shared/gui/gui_textbox.cpp b/engines/ags/shared/gui/gui_textbox.cpp
index b45cbeca29b..2a95dd8fd12 100644
--- a/engines/ags/shared/gui/gui_textbox.cpp
+++ b/engines/ags/shared/gui/gui_textbox.cpp
@@ -62,7 +62,7 @@ Rect GUITextBox::CalcGraphicRect(bool clipped) {
if (IsGUIEnabled(this)) {
// add a cursor
Rect cur_rc = RectWH(
- get_text_width(Text.GetCStr(), Font) + 3,
+ text_rc.Right + 3,
1 + get_font_height(Font),
get_fixed_pixel_size(5),
get_fixed_pixel_size(1) - 1);
Commit: e2d455ee9eb7e92ab81c70b1cf73623690b4b311
https://github.com/scummvm/scummvm/commit/e2d455ee9eb7e92ab81c70b1cf73623690b4b311
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2024-01-17T03:12:29+01:00
Commit Message:
AGS: Updated build version (3.6.0.54)
Paritally from upstream 7a471ddeb30ee16f00397ac6939b334dbba6b717
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 f331ea5b5b5..c37502444b2 100644
--- a/engines/ags/shared/core/def_version.h
+++ b/engines/ags/shared/core/def_version.h
@@ -22,13 +22,13 @@
#ifndef AGS_SHARED_CORE_DEFVERSION_H
#define AGS_SHARED_CORE_DEFVERSION_H
-#define ACI_VERSION_STR "3.6.0.53"
+#define ACI_VERSION_STR "3.6.0.54"
#if defined (RC_INVOKED) // for MSVC resource compiler
-#define ACI_VERSION_MSRC_DEF 3.6.0.53
+#define ACI_VERSION_MSRC_DEF 3.6.0.54
#endif
#define SPECIAL_VERSION ""
-#define ACI_COPYRIGHT_YEARS "2011-2023"
+#define ACI_COPYRIGHT_YEARS "2011-2024"
#endif
Commit: a7266499a599bf4c5d23eb0702b76b1fa8fc1ee1
https://github.com/scummvm/scummvm/commit/a7266499a599bf4c5d23eb0702b76b1fa8fc1ee1
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2024-01-17T03:12:29+01:00
Commit Message:
AGS: Engine: misspelling fix: perfomance->performance
>From upstream c4cf67ac5bc5ac3463609eeefea16c1caa8abab9
Changed paths:
engines/ags/engine/ac/draw_software.cpp
engines/ags/engine/ac/dynobj/script_dict.h
engines/ags/engine/ac/dynobj/script_set.h
engines/ags/engine/gfx/ali_3d_scummvm.cpp
engines/ags/shared/util/buffered_stream.h
diff --git a/engines/ags/engine/ac/draw_software.cpp b/engines/ags/engine/ac/draw_software.cpp
index 5498031b40c..bbca4e09f22 100644
--- a/engines/ags/engine/ac/draw_software.cpp
+++ b/engines/ags/engine/ac/draw_software.cpp
@@ -25,7 +25,7 @@
// dirty rectangles technique.
//
// TODO: do research/profiling to find out if this dirty rectangles thing
-// is still giving ANY notable perfomance boost at all.
+// is still giving ANY notable performance boost at all.
//
// TODO: would that give any benefit to reorganize the code and move dirty
// rectangles into SoftwareGraphicDriver?
diff --git a/engines/ags/engine/ac/dynobj/script_dict.h b/engines/ags/engine/ac/dynobj/script_dict.h
index b10563dc6f7..233f36a4b13 100644
--- a/engines/ags/engine/ac/dynobj/script_dict.h
+++ b/engines/ags/engine/ac/dynobj/script_dict.h
@@ -28,7 +28,7 @@
// that would let expose internal engine's dicts using same interface.
// TODO: maybe optimize key lookup operations further by not creating a String
// object from const char*. It seems, C++14 standard allows to use convertible
-// types as keys; need to research what perfomance impact that would make.
+// types as keys; need to research what performance impact that would make.
//
//=============================================================================
diff --git a/engines/ags/engine/ac/dynobj/script_set.h b/engines/ags/engine/ac/dynobj/script_set.h
index 97f95afb11d..993577610ea 100644
--- a/engines/ags/engine/ac/dynobj/script_set.h
+++ b/engines/ags/engine/ac/dynobj/script_set.h
@@ -27,7 +27,7 @@
// that would let expose internal engine's sets using same interface.
// TODO: maybe optimize key lookup operations further by not creating a String
// object from const char*. It seems, C++14 standard allows to use convertible
-// types as keys; need to research what perfomance impact that would make.
+// types as keys; need to research what performance impact that would make.
//
//=============================================================================
diff --git a/engines/ags/engine/gfx/ali_3d_scummvm.cpp b/engines/ags/engine/gfx/ali_3d_scummvm.cpp
index 70740075441..2000f7f22d7 100644
--- a/engines/ags/engine/gfx/ali_3d_scummvm.cpp
+++ b/engines/ags/engine/gfx/ali_3d_scummvm.cpp
@@ -339,7 +339,7 @@ void ScummVMRendererGraphicsDriver::InitSpriteBatch(size_t index, const SpriteBa
void ScummVMRendererGraphicsDriver::ResetAllBatches() {
// NOTE: we don't release batches themselves here, only sprite lists.
- // This is because we cache batch surfaces, for perfomance reasons.
+ // This is because we cache batch surfaces, for performance reasons.
_spriteList.clear();
}
diff --git a/engines/ags/shared/util/buffered_stream.h b/engines/ags/shared/util/buffered_stream.h
index 4253d12e045..a1b464ea852 100644
--- a/engines/ags/shared/util/buffered_stream.h
+++ b/engines/ags/shared/util/buffered_stream.h
@@ -21,7 +21,7 @@
// BufferedStream represents a buffered file stream; uses memory buffer
// during read and write operations to limit number reads and writes on disk
-// and thus improve i/o perfomance.
+// and thus improve i/o performance.
//
// BufferedSectionStream is a subclass stream that limits reading by an
// arbitrary offset range.
Commit: 4e6d475e177c9fde1e68d77228481b3c620932c6
https://github.com/scummvm/scummvm/commit/4e6d475e177c9fde1e68d77228481b3c620932c6
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2024-01-17T03:12:29+01:00
Commit Message:
AGS: Engine: fixed gamename label not updating if Game.Name changes
>From upstream ae34b8881f64d422971aab3d70758c5184aca0b4
Changed paths:
engines/ags/engine/ac/game.cpp
diff --git a/engines/ags/engine/ac/game.cpp b/engines/ags/engine/ac/game.cpp
index e926ed1699e..7be8468ed55 100644
--- a/engines/ags/engine/ac/game.cpp
+++ b/engines/ags/engine/ac/game.cpp
@@ -598,6 +598,7 @@ void Game_SetName(const char *newName) {
strncpy(_GP(play).game_name, newName, 99);
_GP(play).game_name[99] = 0;
sys_window_set_title(_GP(play).game_name);
+ GUI::MarkSpecialLabelsForUpdate(kLabelMacro_Gamename);
}
int Game_GetSkippingCutscene() {
Commit: 4eaac90e4e873e2bad22d113de6d9513a6259d93
https://github.com/scummvm/scummvm/commit/4eaac90e4e873e2bad22d113de6d9513a6259d93
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2024-01-17T03:12:30+01:00
Commit Message:
AGS: Common: safer reading of fixed-len string fields
>From upstream 458a524a418f30142f5fe2e512902b7e00e97eec
Changed paths:
engines/ags/engine/ac/game_state.cpp
engines/ags/engine/ac/game_state.h
engines/ags/shared/ac/character_info.cpp
engines/ags/shared/ac/character_info.h
engines/ags/shared/ac/game_setup_struct.cpp
engines/ags/shared/ac/game_setup_struct.h
engines/ags/shared/ac/game_setup_struct_base.cpp
engines/ags/shared/ac/inventory_item_info.cpp
engines/ags/shared/ac/inventory_item_info.h
engines/ags/shared/ac/mouse_cursor.cpp
engines/ags/shared/ac/mouse_cursor.h
engines/ags/shared/util/string_utils.cpp
engines/ags/shared/util/string_utils.h
diff --git a/engines/ags/engine/ac/game_state.cpp b/engines/ags/engine/ac/game_state.cpp
index cdade1effd2..24b5eec929e 100644
--- a/engines/ags/engine/ac/game_state.cpp
+++ b/engines/ags/engine/ac/game_state.cpp
@@ -603,6 +603,7 @@ void GameState::ReadFromSavegame(Shared::Stream *in, GameDataVersion data_ver, G
in->Read(playmp3file_name, PLAYMP3FILE_MAX_FILENAME_LEN);
in->Read(globalstrings, MAXGLOBALSTRINGS * MAX_MAXSTRLEN);
in->Read(lastParserEntry, MAX_MAXSTRLEN);
+ StrUtil::ReadCStrCount(game_name, in, MAX_GAME_STATE_NAME_LENGTH);
in->Read(game_name, 100);
ground_level_areas_disabled = in->ReadInt32();
next_screen_transition = in->ReadInt32();
@@ -795,6 +796,7 @@ void GameState::WriteForSavegame(Shared::Stream *out) const {
out->Write(playmp3file_name, PLAYMP3FILE_MAX_FILENAME_LEN);
out->Write(globalstrings, MAXGLOBALSTRINGS * MAX_MAXSTRLEN);
out->Write(lastParserEntry, MAX_MAXSTRLEN);
+ out->Write(game_name, MAX_GAME_STATE_NAME_LENGTH);
out->Write(game_name, 100);
out->WriteInt32(ground_level_areas_disabled);
out->WriteInt32(next_screen_transition);
diff --git a/engines/ags/engine/ac/game_state.h b/engines/ags/engine/ac/game_state.h
index 13b58ac29a2..d7b0ac17d98 100644
--- a/engines/ags/engine/ac/game_state.h
+++ b/engines/ags/engine/ac/game_state.h
@@ -57,6 +57,7 @@ struct ScriptViewport;
struct ScriptCamera;
struct ScriptOverlay;
+#define MAX_GAME_STATE_NAME_LENGTH 100
#define GAME_STATE_RESERVED_INTS 5
// Savegame data format
@@ -221,7 +222,7 @@ struct GameState {
char playmp3file_name[PLAYMP3FILE_MAX_FILENAME_LEN];
char globalstrings[MAXGLOBALSTRINGS][MAX_MAXSTRLEN];
char lastParserEntry[MAX_MAXSTRLEN];
- char game_name[100];
+ char game_name[MAX_GAME_STATE_NAME_LENGTH];
int ground_level_areas_disabled = 0;
int next_screen_transition = 0;
int gamma_adjustment = 0;
diff --git a/engines/ags/shared/ac/character_info.cpp b/engines/ags/shared/ac/character_info.cpp
index 67dfce86afe..99a136b4577 100644
--- a/engines/ags/shared/ac/character_info.cpp
+++ b/engines/ags/shared/ac/character_info.cpp
@@ -23,11 +23,12 @@
#include "ags/shared/ac/character_info.h"
#include "ags/shared/ac/game_version.h"
#include "ags/shared/util/stream.h"
+#include "ags/shared/util/string_utils.h"
#include "ags/globals.h"
namespace AGS3 {
-using AGS::Shared::Stream;
+using namespace AGS::Shared;
void CharacterInfo::ReadFromFile(Stream *in, GameDataVersion data_ver, int save_ver) {
defview = in->ReadInt32();
@@ -73,8 +74,8 @@ void CharacterInfo::ReadFromFile(Stream *in, GameDataVersion data_ver, int save_
in->ReadArrayOfInt16(inv, MAX_INV);
actx = in->ReadInt16();
acty = in->ReadInt16();
- in->Read(name, 40);
- in->Read(scrname, MAX_SCRIPT_NAME_LEN);
+ StrUtil::ReadCStrCount(name, in, MAX_CHAR_NAME_LEN);
+ StrUtil::ReadCStrCount(scrname, in, MAX_SCRIPT_NAME_LEN);
on = in->ReadInt8();
if ((data_ver > kGameVersion_Undefined && data_ver < kGameVersion_360_16) ||
diff --git a/engines/ags/shared/ac/character_info.h b/engines/ags/shared/ac/character_info.h
index 19984971e8f..d3c4f89d642 100644
--- a/engines/ags/shared/ac/character_info.h
+++ b/engines/ags/shared/ac/character_info.h
@@ -63,6 +63,9 @@ using namespace AGS; // FIXME later
#define UNIFORM_WALK_SPEED 0
#define FOLLOW_ALWAYSONTOP 0x7ffe
+// Length of deprecated character name field, in bytes
+#define MAX_CHAR_NAME_LEN 40
+
struct CharacterExtras; // forward declaration
// IMPORTANT: exposed to script API, and plugin API as AGSCharacter!
// For older script compatibility the struct also has to maintain its size;
@@ -100,7 +103,7 @@ struct CharacterInfo {
short walkspeed, animspeed;
short inv[MAX_INV];
short actx, acty;
- char name[40];
+ char name[MAX_CHAR_NAME_LEN];
char scrname[MAX_SCRIPT_NAME_LEN];
int8 on;
diff --git a/engines/ags/shared/ac/game_setup_struct.cpp b/engines/ags/shared/ac/game_setup_struct.cpp
index ec3eb66fd21..b2436234325 100644
--- a/engines/ags/shared/ac/game_setup_struct.cpp
+++ b/engines/ags/shared/ac/game_setup_struct.cpp
@@ -26,6 +26,7 @@
#include "ags/shared/ac/dynobj/script_audio_clip.h"
#include "ags/shared/game/interactions.h"
#include "ags/shared/util/aligned_stream.h"
+#include "ags/shared/util/string_utils.h"
#include "ags/globals.h"
namespace AGS3 {
@@ -36,7 +37,6 @@ GameSetupStruct::GameSetupStruct()
: filever(0)
, roomCount(0)
, scoreClipID(0) {
- memset(invinfo, 0, sizeof(invinfo));
memset(lipSyncFrameLetters, 0, sizeof(lipSyncFrameLetters));
memset(guid, 0, sizeof(guid));
memset(saveGameFileExtension, 0, sizeof(saveGameFileExtension));
@@ -104,9 +104,9 @@ ScriptAudioClip *GetAudioClipForOldStyleNumber(GameSetupStruct &game, bool is_mu
void GameSetupStruct::read_savegame_info(Shared::Stream *in, GameDataVersion data_ver) {
if (data_ver > kGameVersion_272) { // only 3.x
- in->Read(&guid[0], MAX_GUID_LENGTH);
- in->Read(&saveGameFileExtension[0], MAX_SG_EXT_LENGTH);
- in->Read(&saveGameFolderName[0], MAX_SG_FOLDER_LEN);
+ StrUtil::ReadCStrCount(guid, in, MAX_GUID_LENGTH);
+ StrUtil::ReadCStrCount(saveGameFileExtension, in, MAX_SG_EXT_LENGTH);
+ StrUtil::ReadCStrCount(saveGameFolderName, in, MAX_SG_FOLDER_LEN);
}
}
diff --git a/engines/ags/shared/ac/game_setup_struct.h b/engines/ags/shared/ac/game_setup_struct.h
index 31adfa497c1..2b568f3cbb2 100644
--- a/engines/ags/shared/ac/game_setup_struct.h
+++ b/engines/ags/shared/ac/game_setup_struct.h
@@ -55,7 +55,7 @@ struct GameSetupStruct : public GameSetupStructBase {
// font parameters are then put and queried in the fonts module
// TODO: split into installation params (used only when reading) and runtime params
std::vector<FontInfo> fonts;
- InventoryItemInfo invinfo[MAX_INV];
+ InventoryItemInfo invinfo[MAX_INV]{};
std::vector<MouseCursor> mcurs;
std::vector<PInteraction> intrChar;
PInteraction intrInv[MAX_INV];
diff --git a/engines/ags/shared/ac/game_setup_struct_base.cpp b/engines/ags/shared/ac/game_setup_struct_base.cpp
index 6d79add7151..da017dc0d27 100644
--- a/engines/ags/shared/ac/game_setup_struct_base.cpp
+++ b/engines/ags/shared/ac/game_setup_struct_base.cpp
@@ -26,10 +26,11 @@
#include "ags/shared/ac/words_dictionary.h"
#include "ags/shared/script/cc_script.h"
#include "ags/shared/util/stream.h"
+#include "ags/shared/util/string_utils.h"
namespace AGS3 {
-using AGS::Shared::Stream;
+using namespace AGS::Shared;
GameSetupStructBase::GameSetupStructBase()
: numviews(0)
@@ -143,7 +144,7 @@ void GameSetupStructBase::OnResolutionSet() {
}
void GameSetupStructBase::ReadFromFile(Stream *in, GameDataVersion game_ver) {
- in->Read(&gamename[0], GAME_NAME_LENGTH);
+ StrUtil::ReadCStrCount(gamename, in, GAME_NAME_LENGTH);
in->ReadArrayOfInt32(options, MAX_OPTIONS);
if (game_ver < kGameVersion_340_4) { // TODO: this should probably be possible to deduce script API level
// using game data version and other options like OPT_STRICTSCRIPTING
@@ -192,7 +193,7 @@ void GameSetupStructBase::ReadFromFile(Stream *in, GameDataVersion game_ver) {
}
void GameSetupStructBase::WriteToFile(Stream *out) const {
- out->Write(&gamename[0], GAME_NAME_LENGTH);
+ out->Write(gamename, GAME_NAME_LENGTH);
out->WriteArrayOfInt32(options, MAX_OPTIONS);
out->Write(&paluses[0], sizeof(paluses));
// colors are an array of chars
diff --git a/engines/ags/shared/ac/inventory_item_info.cpp b/engines/ags/shared/ac/inventory_item_info.cpp
index f19bdca85c4..5deb19f5c8a 100644
--- a/engines/ags/shared/ac/inventory_item_info.cpp
+++ b/engines/ags/shared/ac/inventory_item_info.cpp
@@ -28,7 +28,7 @@ namespace AGS3 {
using namespace AGS::Shared;
void InventoryItemInfo::ReadFromFile(Stream *in) {
- in->Read(name, 25);
+ StrUtil::ReadCStrCount(name, in, MAX_INVENTORY_NAME_LENGTH);
pic = in->ReadInt32();
cursorPic = in->ReadInt32();
hotx = in->ReadInt32();
@@ -38,7 +38,7 @@ void InventoryItemInfo::ReadFromFile(Stream *in) {
}
void InventoryItemInfo::WriteToFile(Stream *out) {
- out->Write(name, 25);
+ out->Write(name, MAX_INVENTORY_NAME_LENGTH);
out->WriteInt32(pic);
out->WriteInt32(cursorPic);
out->WriteInt32(hotx);
diff --git a/engines/ags/shared/ac/inventory_item_info.h b/engines/ags/shared/ac/inventory_item_info.h
index 3626d11f914..39e298d5e8c 100644
--- a/engines/ags/shared/ac/inventory_item_info.h
+++ b/engines/ags/shared/ac/inventory_item_info.h
@@ -35,8 +35,10 @@ class Stream;
using namespace AGS; // FIXME later
#define IFLG_STARTWITH 1
+#define MAX_INVENTORY_NAME_LENGTH 25
+
struct InventoryItemInfo {
- char name[25];
+ char name[MAX_INVENTORY_NAME_LENGTH];
int pic;
int cursorPic, hotx, hoty;
int32_t reserved[5];
diff --git a/engines/ags/shared/ac/mouse_cursor.cpp b/engines/ags/shared/ac/mouse_cursor.cpp
index 24ee06e6fe8..255b1111ed0 100644
--- a/engines/ags/shared/ac/mouse_cursor.cpp
+++ b/engines/ags/shared/ac/mouse_cursor.cpp
@@ -21,11 +21,12 @@
#include "ags/shared/ac/mouse_cursor.h"
#include "ags/shared/util/stream.h"
+#include "ags/shared/util/string_utils.h"
#include "common/util.h"
namespace AGS3 {
-using AGS::Shared::Stream;
+using namespace AGS::Shared;
void MouseCursor::clear() {
pic = 0;
@@ -40,7 +41,7 @@ void MouseCursor::ReadFromFile(Stream *in) {
hotx = in->ReadInt16();
hoty = in->ReadInt16();
view = in->ReadInt16();
- in->Read(name, 10);
+ StrUtil::ReadCStrCount(name, in, MAX_CURSOR_NAME_LENGTH);
flags = in->ReadInt8();
}
@@ -49,7 +50,7 @@ void MouseCursor::WriteToFile(Stream *out) {
out->WriteInt16(hotx);
out->WriteInt16(hoty);
out->WriteInt16(view);
- out->Write(name, 10);
+ out->Write(name, MAX_CURSOR_NAME_LENGTH);
out->WriteInt8(flags);
}
diff --git a/engines/ags/shared/ac/mouse_cursor.h b/engines/ags/shared/ac/mouse_cursor.h
index 6e65290bdca..428e0775579 100644
--- a/engines/ags/shared/ac/mouse_cursor.h
+++ b/engines/ags/shared/ac/mouse_cursor.h
@@ -39,13 +39,15 @@ using namespace AGS; // FIXME later
#define MCF_STANDARD 4
#define MCF_HOTSPOT 8 // only animate when over hotspot
+#define MAX_CURSOR_NAME_LENGTH 10
+
// IMPORTANT: exposed to plugin API as AGSCursor!
// do not change topmost fields, unless planning breaking compatibility.
struct MouseCursor {
int pic = 0;
short hotx = 0, hoty = 0;
short view = -1;
- char name[10]{};
+ char name[MAX_CURSOR_NAME_LENGTH]{};
char flags = 0;
// up to here is a part of plugin API
diff --git a/engines/ags/shared/util/string_utils.cpp b/engines/ags/shared/util/string_utils.cpp
index e76aee79681..4e6cd4f70a7 100644
--- a/engines/ags/shared/util/string_utils.cpp
+++ b/engines/ags/shared/util/string_utils.cpp
@@ -200,6 +200,11 @@ void StrUtil::ReadCStr(char *buf, Stream *in, size_t buf_limit) {
}
}
+void StrUtil::ReadCStrCount(char *buf, Stream *in, size_t count) {
+ in->Read(buf, count);
+ buf[count - 1] = 0; // for safety
+}
+
char *StrUtil::ReadMallocCStrOrNull(Stream *in) {
char buf[1024];
for (auto ptr = buf; (ptr < buf + sizeof(buf)); ++ptr) {
diff --git a/engines/ags/shared/util/string_utils.h b/engines/ags/shared/util/string_utils.h
index 298a6f0490f..c0b196d98d1 100644
--- a/engines/ags/shared/util/string_utils.h
+++ b/engines/ags/shared/util/string_utils.h
@@ -77,7 +77,16 @@ void WriteString(const char *cstr, Stream *out);
void WriteString(const char *cstr, size_t len, Stream *out);
// Serialize and unserialize string as c-string (null-terminated sequence)
-void ReadCStr(char *buf, Stream *in, size_t buf_limit);
+//
+// Reads a null-terminated string until getting a null-terminator.
+// writes into the buffer up to the buf_limit.
+// Note that this will keep reading the stream out until 0 is read,
+// even if buffer is already full.
+// Guarantees that output buffer will contain a null-terminator.
+void ReadCStr(char *buf, Stream *in, size_t buf_limit);
+// Reads N characters into the provided buffer.
+// Guarantees that output buffer will contain a null-terminator.
+void ReadCStrCount(char *buf, Stream *in, size_t count);
// Reads a null-terminated string and !! mallocs !! a char buffer for it;
// returns nullptr if the read string is empty.
// Buffer is hard-limited to 1024 bytes, including null-terminator.
Commit: cce6aff7544ed0e45f98911bceff9f2e40a10485
https://github.com/scummvm/scummvm/commit/cce6aff7544ed0e45f98911bceff9f2e40a10485
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2024-01-17T03:12:30+01:00
Commit Message:
AGS: Engine: replaced uses of strncpy with snprintf for safety
>From upstream 02feb81b34f041dccd8a4bb33ff060cc532d979b
Changed paths:
engines/ags/engine/ac/game.cpp
engines/ags/engine/ac/global_inventory_item.cpp
engines/ags/engine/ac/listbox.cpp
engines/ags/engine/gui/my_label.cpp
engines/ags/engine/gui/my_push_button.cpp
engines/ags/engine/main/engine.cpp
engines/ags/engine/main/main.cpp
engines/ags/engine/script/script.cpp
diff --git a/engines/ags/engine/ac/game.cpp b/engines/ags/engine/ac/game.cpp
index 7be8468ed55..575a995c0ed 100644
--- a/engines/ags/engine/ac/game.cpp
+++ b/engines/ags/engine/ac/game.cpp
@@ -595,8 +595,7 @@ const char *Game_GetName() {
}
void Game_SetName(const char *newName) {
- strncpy(_GP(play).game_name, newName, 99);
- _GP(play).game_name[99] = 0;
+ snprintf(_GP(play).game_name, MAX_GAME_STATE_NAME_LENGTH, "%s", newName);
sys_window_set_title(_GP(play).game_name);
GUI::MarkSpecialLabelsForUpdate(kLabelMacro_Gamename);
}
diff --git a/engines/ags/engine/ac/global_inventory_item.cpp b/engines/ags/engine/ac/global_inventory_item.cpp
index 3c4ed921009..134377cccb6 100644
--- a/engines/ags/engine/ac/global_inventory_item.cpp
+++ b/engines/ags/engine/ac/global_inventory_item.cpp
@@ -58,10 +58,7 @@ void SetInvItemName(int invi, const char *newName) {
if ((invi < 1) || (invi > _GP(game).numinvitems))
quit("!SetInvName: invalid inventory item specified");
- // set the new name, making sure it doesn't overflow the buffer
- strncpy(_GP(game).invinfo[invi].name, newName, 25);
- _GP(game).invinfo[invi].name[24] = 0;
-
+ snprintf(_GP(game).invinfo[invi].name, MAX_INVENTORY_NAME_LENGTH, "%s", newName);
// might need to redraw the GUI if it has the inv item name on it
GUI::MarkSpecialLabelsForUpdate(kLabelMacro_Overhotspot);
}
diff --git a/engines/ags/engine/ac/listbox.cpp b/engines/ags/engine/ac/listbox.cpp
index daaaa85ecbc..9ee19cd093a 100644
--- a/engines/ags/engine/ac/listbox.cpp
+++ b/engines/ags/engine/ac/listbox.cpp
@@ -190,8 +190,7 @@ int ListBox_GetItemAtLocation(GUIListBox *listbox, int x, int y) {
char *ListBox_GetItemText(GUIListBox *listbox, int index, char *buffer) {
if ((index < 0) || (index >= listbox->ItemCount))
quit("!ListBoxGetItemText: invalid item specified");
- strncpy(buffer, listbox->Items[index].GetCStr(), 198);
- buffer[199] = 0;
+ snprintf(buffer, MAX_MAXSTRLEN, "%s", listbox->Items[index].GetCStr());
return buffer;
}
diff --git a/engines/ags/engine/gui/my_label.cpp b/engines/ags/engine/gui/my_label.cpp
index 754f0c71b48..d6a9cdcb6a3 100644
--- a/engines/ags/engine/gui/my_label.cpp
+++ b/engines/ags/engine/gui/my_label.cpp
@@ -33,8 +33,7 @@ namespace AGS3 {
using namespace Shared;
MyLabel::MyLabel(int xx, int yy, int wii, const char *tee) {
- strncpy(text, tee, 150);
- text[149] = 0;
+ snprintf(text, sizeof(text), "%s", tee);
x = xx;
y = yy;
wid = wii;
diff --git a/engines/ags/engine/gui/my_push_button.cpp b/engines/ags/engine/gui/my_push_button.cpp
index 715bba56cae..a7d82d6db89 100644
--- a/engines/ags/engine/gui/my_push_button.cpp
+++ b/engines/ags/engine/gui/my_push_button.cpp
@@ -40,8 +40,7 @@ MyPushButton::MyPushButton(int xx, int yy, int wi, int hi, const char *tex) {
wid = wi;
hit = hi + 1; //hit=hi;
state = 0;
- strncpy(text, tex, 50);
- text[49] = 0;
+ snprintf(text, sizeof(text), "%s", tex);
}
void MyPushButton::draw(Bitmap *ds) {
diff --git a/engines/ags/engine/main/engine.cpp b/engines/ags/engine/main/engine.cpp
index b1ce90e7122..18baecc21e8 100644
--- a/engines/ags/engine/main/engine.cpp
+++ b/engines/ags/engine/main/engine.cpp
@@ -779,7 +779,7 @@ void engine_init_game_settings() {
void engine_setup_scsystem_auxiliary() {
// ScriptSystem::aci_version is only 10 chars long
- Common::strlcpy(_GP(scsystem).aci_version, _G(EngineVersion).LongString.GetCStr(), 10);
+ snprintf(_GP(scsystem).aci_version, sizeof(_GP(scsystem).aci_version), "%s", _G(EngineVersion).LongString.GetCStr());
if (_GP(usetup).override_script_os >= 0) {
_GP(scsystem).os = _GP(usetup).override_script_os;
} else {
diff --git a/engines/ags/engine/main/main.cpp b/engines/ags/engine/main/main.cpp
index be5312f294f..b002a82477e 100644
--- a/engines/ags/engine/main/main.cpp
+++ b/engines/ags/engine/main/main.cpp
@@ -213,8 +213,7 @@ int main_process_cmdline(ConfigTree &cfg, int argc, const char *argv[]) {
if (argc < ee + 2)
break;
_GP(play).takeover_data = atoi(argv[ee + 1]);
- strncpy(_GP(play).takeover_from, argv[ee + 2], 49);
- _GP(play).takeover_from[49] = 0;
+ snprintf(_GP(play).takeover_from, sizeof(_GP(play).takeover_from), "%s", argv[ee + 2]);
ee += 2;
} else if (ags_stricmp(arg, "--clear-cache-on-room-change") == 0) {
cfg["misc"]["clear_cache_on_room_change"] = "1";
diff --git a/engines/ags/engine/script/script.cpp b/engines/ags/engine/script/script.cpp
index 89724d1897d..cb37471659c 100644
--- a/engines/ags/engine/script/script.cpp
+++ b/engines/ags/engine/script/script.cpp
@@ -334,7 +334,7 @@ static int PrepareTextScript(ccInstance *sci, const char **tsname) {
if (_G(num_scripts) >= MAX_SCRIPT_AT_ONCE)
quit("too many nested text script instances created");
// in case script_run_another is the function name, take a backup
- strncpy(scfunctionname, tsname[0], MAX_FUNCTION_NAME_LEN);
+ snprintf(scfunctionname, sizeof(scfunctionname), "%s", tsname[0]);
tsname[0] = &scfunctionname[0];
update_script_mouse_coords();
_G(inside_script)++;
Commit: d18f7cac259c7be356d9daf7bd25320a6f1089ce
https://github.com/scummvm/scummvm/commit/d18f7cac259c7be356d9daf7bd25320a6f1089ce
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2024-01-17T03:12:31+01:00
Commit Message:
AGS: Engine: replaced another case of strncpy with snprintf
>From upstream 73e49b44db8042aa307bff7fadf51f67156658be
Changed paths:
engines/ags/engine/ac/character.cpp
diff --git a/engines/ags/engine/ac/character.cpp b/engines/ags/engine/ac/character.cpp
index 3b153387a10..7a430a4e132 100644
--- a/engines/ags/engine/ac/character.cpp
+++ b/engines/ags/engine/ac/character.cpp
@@ -1334,8 +1334,7 @@ const char *Character_GetName(CharacterInfo *chaa) {
}
void Character_SetName(CharacterInfo *chaa, const char *newName) {
- strncpy(chaa->name, newName, 40);
- chaa->name[39] = 0;
+ snprintf(chaa->name, MAX_CHAR_NAME_LEN, "%s", newName);
GUI::MarkSpecialLabelsForUpdate(kLabelMacro_Overhotspot);
}
Commit: 46b14a21c6af4af7c6fe794714edbe43ee531fae
https://github.com/scummvm/scummvm/commit/46b14a21c6af4af7c6fe794714edbe43ee531fae
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2024-01-17T03:12:31+01:00
Commit Message:
AGS: Engine: safety check for fixups with out of range code reference
>From upstream 973845a15ed9726956895161c8847bc668c3e787
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 5f36b8e56ef..d54ec3f005c 100644
--- a/engines/ags/engine/script/cc_instance.cpp
+++ b/engines/ags/engine/script/cc_instance.cpp
@@ -1668,13 +1668,18 @@ static void cc_error_fixups(const ccScript *scri, size_t pc, const char *fmt, ..
bool ccInstance::CreateRuntimeCodeFixups(const ccScript *scri) {
code_fixups = new char[scri->codesize]();
for (int i = 0; i < scri->numfixups; ++i) {
+ const int32_t fixup = scri->fixups[i];
+ if (fixup < 0 || fixup >= scri->codesize) {
+ cc_error_fixups(scri, SIZE_MAX, "bad fixup at %d (fixup type %d, bytecode pos %d, bytecode range is 0..%d)",
+ i, scri->fixuptypes[i], fixup, scri->codesize);
+ return false;
+ }
+
if (scri->fixuptypes[i] == FIXUP_DATADATA) {
continue;
}
- int32_t fixup = scri->fixups[i];
code_fixups[fixup] = scri->fixuptypes[i];
-
switch (scri->fixuptypes[i]) {
case FIXUP_GLOBALDATA: {
ScriptVariable *gl_var = FindGlobalVar((int32_t)code[fixup]);
Commit: 7e003f30e932d817a52974b7a2077968b540dd31
https://github.com/scummvm/scummvm/commit/7e003f30e932d817a52974b7a2077968b540dd31
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2024-01-17T03:12:31+01:00
Commit Message:
AGS: Engine: allow old-style resolution upscale for kGameResolution_Default
>From upstream a7f3c775de0f1a82c34b5f3acd67418aec31bf17
Changed paths:
engines/ags/engine/main/config.cpp
diff --git a/engines/ags/engine/main/config.cpp b/engines/ags/engine/main/config.cpp
index 3d138e8a30d..0fb17c7d158 100644
--- a/engines/ags/engine/main/config.cpp
+++ b/engines/ags/engine/main/config.cpp
@@ -189,10 +189,10 @@ void config_defaults() {
static void read_legacy_graphics_config(const ConfigTree &cfg) {
// Pre-3.* game resolution setup
- int default_res = CfgReadInt(cfg, "misc", "defaultres", 0);
+ int default_res = CfgReadInt(cfg, "misc", "defaultres", kGameResolution_Default);
int screen_res = CfgReadInt(cfg, "misc", "screenres", 0);
- if ((default_res == kGameResolution_320x200 ||
- default_res == kGameResolution_320x240) && screen_res > 0) {
+ if (screen_res > 0 &&
+ (default_res >= kGameResolution_Default && default_res <= kGameResolution_320x240)) {
_GP(usetup).override_upscale = true; // run low-res game in high-res mode
}
Commit: 30fc1a911d20f2aeb888d72b43d651b2a93a2c08
https://github.com/scummvm/scummvm/commit/30fc1a911d20f2aeb888d72b43d651b2a93a2c08
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2024-01-17T03:12:31+01:00
Commit Message:
AGS: Engine: fixed System.ColorDepth to returning game's native depth
This logic got confused at some point in engine development. This property had a meaning back when display mode matched the game's native color depth.
Plugins also could rely on this, when drawing on a software renderer's virtual screen, which must match game's native depth and not the final display resolution.
>From upstream 67c3bdc403d5178f1c5c390af820bc446f94f21b
Changed paths:
engines/ags/engine/ac/dynobj/script_system.h
engines/ags/engine/main/engine_setup.cpp
engines/ags/plugins/ags_plugin.cpp
diff --git a/engines/ags/engine/ac/dynobj/script_system.h b/engines/ags/engine/ac/dynobj/script_system.h
index 89bad5b2a2c..7e212cc357d 100644
--- a/engines/ags/engine/ac/dynobj/script_system.h
+++ b/engines/ags/engine/ac/dynobj/script_system.h
@@ -35,7 +35,7 @@ namespace AGS3 {
struct ScriptSystem {
int width = 0; // game screen width
int height = 0; // game screen height
- int coldepth = 0; // game's color depth
+ int coldepth = 0; // game's color depth, in bits per pixel (8, 16, 32)
int os = 0; // operating system's code (see eScriptSystemOSID)
int windowed = 0; // windowed/fullscreen flag
int vsync = 0; // vertical sync flag
diff --git a/engines/ags/engine/main/engine_setup.cpp b/engines/ags/engine/main/engine_setup.cpp
index 5a08c7d5452..78b07bf2efc 100644
--- a/engines/ags/engine/main/engine_setup.cpp
+++ b/engines/ags/engine/main/engine_setup.cpp
@@ -119,6 +119,7 @@ void convert_objects_to_data_resolution(GameDataVersion filever) {
void engine_setup_system_gamesize() {
_GP(scsystem).width = _GP(game).GetGameRes().Width;
_GP(scsystem).height = _GP(game).GetGameRes().Height;
+ _GP(scsystem).coldepth = _GP(game).GetColorDepth();
_GP(scsystem).viewport_width = game_to_data_coord(_GP(play).GetMainViewport().GetWidth());
_GP(scsystem).viewport_height = game_to_data_coord(_GP(play).GetMainViewport().GetHeight());
}
@@ -254,7 +255,6 @@ void engine_pre_gfxmode_mouse_cleanup() {
// Fill in _GP(scsystem) struct with display mode parameters
void engine_setup_scsystem_screen(const DisplayMode &dm) {
- _GP(scsystem).coldepth = dm.ColorDepth;
_GP(scsystem).windowed = dm.IsWindowed();
_GP(scsystem).vsync = dm.Vsync;
}
diff --git a/engines/ags/plugins/ags_plugin.cpp b/engines/ags/plugins/ags_plugin.cpp
index 569f48e1f1c..86d613e9c31 100644
--- a/engines/ags/plugins/ags_plugin.cpp
+++ b/engines/ags/plugins/ags_plugin.cpp
@@ -177,12 +177,12 @@ void IAGSEngine::DrawText(int32 x, int32 y, int32 font, int32 color, const char
}
void IAGSEngine::GetScreenDimensions(int32 *width, int32 *height, int32 *coldepth) {
- if (width != nullptr)
- width[0] = _GP(play).GetMainViewport().GetWidth();
- if (height != nullptr)
- height[0] = _GP(play).GetMainViewport().GetHeight();
- if (coldepth != nullptr)
- coldepth[0] = _GP(scsystem).coldepth;
+ if (width)
+ *width = _GP(play).GetMainViewport().GetWidth();
+ if (height)
+ *height = _GP(play).GetMainViewport().GetHeight();
+ if (coldepth)
+ *coldepth = _GP(scsystem).coldepth;
}
int IAGSEngine::GetBitmapPitch(BITMAP *bmp) {
Commit: de715bab921e5520842b0ed2288c0a35befe8212
https://github.com/scummvm/scummvm/commit/de715bab921e5520842b0ed2288c0a35befe8212
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2024-01-17T03:12:31+01:00
Commit Message:
AGS: Engine: fixed uses of scsystem.color_depth
This complements 67c3bdc
>From upstream 79c70aac2b0df604cdb7adab8fc596a18c7d4c74
Changed paths:
engines/ags/engine/ac/draw.cpp
engines/ags/engine/main/engine.cpp
engines/ags/engine/main/engine_setup.cpp
engines/ags/engine/main/engine_setup.h
diff --git a/engines/ags/engine/ac/draw.cpp b/engines/ags/engine/ac/draw.cpp
index 66f6320e9be..bfd6208ae24 100644
--- a/engines/ags/engine/ac/draw.cpp
+++ b/engines/ags/engine/ac/draw.cpp
@@ -131,15 +131,13 @@ Bitmap *convert_32_to_32bgr(Bitmap *tempbl) {
return tempbl;
}
-// NOTE: Some of these conversions are required even when using
+// NOTE: Some of these conversions are required even when using
// D3D and OpenGL rendering, for two reasons:
// 1) certain raw drawing operations are still performed by software
// Allegro methods, hence bitmaps should be kept compatible to any native
// software operations, such as blitting two bitmaps of different formats.
-// 2) mobile ports feature an OpenGL renderer built in Allegro library,
-// that assumes native bitmaps are in OpenGL-compatible format, so that it
-// could copy them to texture without additional changes.
-// AGS own OpenGL renderer tries to sync its behavior with the former one.
+// 2) OpenGL renderer assumes native bitmaps are in OpenGL-compatible format,
+// so that it could copy them to texture without additional changes.
//
// TODO: make _G(gfxDriver)->GetCompatibleBitmapFormat describe all necessary
// conversions, so that we did not have to guess.
@@ -162,7 +160,7 @@ Bitmap *AdjustBitmapForUseWithDisplayMode(Bitmap *bitmap, bool has_alpha) {
// to match graphics driver expectation about pixel format.
// TODO: make GetCompatibleBitmapFormat tell this somehow
#if defined (AGS_INVERTED_COLOR_ORDER)
- const int sys_col_depth = System_GetColorDepth();
+ const int sys_col_depth = _G(gfxDriver)->GetDisplayMode().ColorDepth;
if (sys_col_depth > 16 && bmp_col_depth == 32) {
// Convert RGB to BGR.
new_bitmap = convert_32_to_32bgr(bitmap);
diff --git a/engines/ags/engine/main/engine.cpp b/engines/ags/engine/main/engine.cpp
index 18baecc21e8..43dcef76aec 100644
--- a/engines/ags/engine/main/engine.cpp
+++ b/engines/ags/engine/main/engine.cpp
@@ -1183,6 +1183,8 @@ int initialize_engine(const ConfigTree &startup_opts) {
}
bool engine_try_set_gfxmode_any(const DisplayModeSetup &setup) {
+ const DisplayMode old_dm = _G(gfxDriver) ? _G(gfxDriver)->GetDisplayMode() : DisplayMode();
+
engine_shutdown_gfxmode();
sys_renderer_set_output(_GP(usetup).software_render_driver);
@@ -1192,7 +1194,7 @@ bool engine_try_set_gfxmode_any(const DisplayModeSetup &setup) {
setup, ColorDepthOption(_GP(game).GetColorDepth()));
if (res)
- engine_post_gfxmode_setup(init_desktop);
+ engine_post_gfxmode_setup(init_desktop, old_dm);
// Make sure that we don't receive window events queued during init
sys_flush_events();
return res;
@@ -1246,7 +1248,7 @@ bool engine_try_switch_windowed_gfxmode() {
// active display mode.
if (!_G(gfxDriver)->GetDisplayMode().IsRealFullscreen())
init_desktop = get_desktop_size();
- engine_post_gfxmode_setup(init_desktop);
+ engine_post_gfxmode_setup(init_desktop, old_dm);
// Make sure that we don't receive window events queued during init
sys_flush_events();
return res;
diff --git a/engines/ags/engine/main/engine_setup.cpp b/engines/ags/engine/main/engine_setup.cpp
index 78b07bf2efc..0e44ac564d9 100644
--- a/engines/ags/engine/main/engine_setup.cpp
+++ b/engines/ags/engine/main/engine_setup.cpp
@@ -259,11 +259,11 @@ void engine_setup_scsystem_screen(const DisplayMode &dm) {
_GP(scsystem).vsync = dm.Vsync;
}
-void engine_post_gfxmode_setup(const Size &init_desktop) {
+void engine_post_gfxmode_setup(const Size &init_desktop, const DisplayMode &old_dm) {
DisplayMode dm = _G(gfxDriver)->GetDisplayMode();
// If color depth has changed (or graphics mode was inited for the
// very first time), we also need to recreate bitmaps
- bool has_driver_changed = _GP(scsystem).coldepth != dm.ColorDepth;
+ bool has_driver_changed = old_dm.ColorDepth != dm.ColorDepth;
engine_setup_scsystem_screen(dm);
engine_post_gfxmode_driver_setup();
diff --git a/engines/ags/engine/main/engine_setup.h b/engines/ags/engine/main/engine_setup.h
index 29561550e53..a723cd41882 100644
--- a/engines/ags/engine/main/engine_setup.h
+++ b/engines/ags/engine/main/engine_setup.h
@@ -31,7 +31,7 @@ namespace AGS3 {
// TODO: this is part of the game init, not engine init, move it later
void engine_init_resolution_settings(const Size game_size);
// Setup engine after the graphics mode has changed
-void engine_post_gfxmode_setup(const Size &init_desktop);
+void engine_post_gfxmode_setup(const Size &init_desktop, const DisplayMode &old_dm);
// Prepare engine for graphics mode release; could be called before switching display mode too
void engine_pre_gfxmode_release();
// Prepare engine to the graphics mode shutdown and gfx driver destruction
Commit: 2c35d26b829479b6d292bc429ac97c9936794ef3
https://github.com/scummvm/scummvm/commit/2c35d26b829479b6d292bc429ac97c9936794ef3
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2024-01-17T03:12:32+01:00
Commit Message:
AGS: Updated build version (3.6.0.55)
Partially from upstream b9f4415f24e52b90b3fddd10cf81b7bd97d715e8
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 c37502444b2..87232baf00b 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.54"
+#define ACI_VERSION_STR "3.6.0.55"
#if defined (RC_INVOKED) // for MSVC resource compiler
-#define ACI_VERSION_MSRC_DEF 3.6.0.54
+#define ACI_VERSION_MSRC_DEF 3.6.0.55
#endif
#define SPECIAL_VERSION ""
Commit: 7a281232f64af8c860af1fd452e1f4092ff4f85f
https://github.com/scummvm/scummvm/commit/7a281232f64af8c860af1fd452e1f4092ff4f85f
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2024-01-17T03:12:32+01:00
Commit Message:
AGS: Remove leftover lines breaking save/load
Changed paths:
engines/ags/engine/ac/game_state.cpp
diff --git a/engines/ags/engine/ac/game_state.cpp b/engines/ags/engine/ac/game_state.cpp
index 24b5eec929e..90ce15f656b 100644
--- a/engines/ags/engine/ac/game_state.cpp
+++ b/engines/ags/engine/ac/game_state.cpp
@@ -604,7 +604,6 @@ void GameState::ReadFromSavegame(Shared::Stream *in, GameDataVersion data_ver, G
in->Read(globalstrings, MAXGLOBALSTRINGS * MAX_MAXSTRLEN);
in->Read(lastParserEntry, MAX_MAXSTRLEN);
StrUtil::ReadCStrCount(game_name, in, MAX_GAME_STATE_NAME_LENGTH);
- in->Read(game_name, 100);
ground_level_areas_disabled = in->ReadInt32();
next_screen_transition = in->ReadInt32();
in->ReadInt32(); // gamma_adjustment -- do not apply gamma level from savegame
@@ -797,7 +796,6 @@ void GameState::WriteForSavegame(Shared::Stream *out) const {
out->Write(globalstrings, MAXGLOBALSTRINGS * MAX_MAXSTRLEN);
out->Write(lastParserEntry, MAX_MAXSTRLEN);
out->Write(game_name, MAX_GAME_STATE_NAME_LENGTH);
- out->Write(game_name, 100);
out->WriteInt32(ground_level_areas_disabled);
out->WriteInt32(next_screen_transition);
out->WriteInt32(gamma_adjustment);
Commit: a660cd67a45643ea15025f3cdf1191c92912f54f
https://github.com/scummvm/scummvm/commit/a660cd67a45643ea15025f3cdf1191c92912f54f
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2024-01-17T03:12:32+01:00
Commit Message:
AGS: Engine: fixed bytecode fixup assertion done for unapplicable case
Was broken by 973845a
>From upstream 9d86d5ab1a6e84115c33ffbfc8a96185e6b9fd63
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 d54ec3f005c..42cb7163223 100644
--- a/engines/ags/engine/script/cc_instance.cpp
+++ b/engines/ags/engine/script/cc_instance.cpp
@@ -1668,6 +1668,10 @@ static void cc_error_fixups(const ccScript *scri, size_t pc, const char *fmt, ..
bool ccInstance::CreateRuntimeCodeFixups(const ccScript *scri) {
code_fixups = new char[scri->codesize]();
for (int i = 0; i < scri->numfixups; ++i) {
+ if (scri->fixuptypes[i] == FIXUP_DATADATA) {
+ continue;
+ }
+
const int32_t fixup = scri->fixups[i];
if (fixup < 0 || fixup >= scri->codesize) {
cc_error_fixups(scri, SIZE_MAX, "bad fixup at %d (fixup type %d, bytecode pos %d, bytecode range is 0..%d)",
@@ -1675,10 +1679,6 @@ bool ccInstance::CreateRuntimeCodeFixups(const ccScript *scri) {
return false;
}
- if (scri->fixuptypes[i] == FIXUP_DATADATA) {
- continue;
- }
-
code_fixups[fixup] = scri->fixuptypes[i];
switch (scri->fixuptypes[i]) {
case FIXUP_GLOBALDATA: {
Commit: d1d5d2ed7d5c56c0fa93173c16aaa98a953c69e8
https://github.com/scummvm/scummvm/commit/d1d5d2ed7d5c56c0fa93173c16aaa98a953c69e8
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2024-01-17T03:12:32+01:00
Commit Message:
AGS: Updated build version (3.6.0.56)
Partially from upstream 95c62e15aa7bfa173a2b53ab20770a36e633f6fe
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 87232baf00b..82725fe8f64 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.55"
+#define ACI_VERSION_STR "3.6.0.56"
#if defined (RC_INVOKED) // for MSVC resource compiler
-#define ACI_VERSION_MSRC_DEF 3.6.0.55
+#define ACI_VERSION_MSRC_DEF 3.6.0.56
#endif
#define SPECIAL_VERSION ""
Commit: d42e55212cb49a21269eb3ae5c4073406381fe44
https://github.com/scummvm/scummvm/commit/d42e55212cb49a21269eb3ae5c4073406381fe44
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2024-01-17T03:12:32+01:00
Commit Message:
AGS: Return more meaningful message in GetDriverName
Changed paths:
engines/ags/engine/gfx/ali_3d_scummvm.h
diff --git a/engines/ags/engine/gfx/ali_3d_scummvm.h b/engines/ags/engine/gfx/ali_3d_scummvm.h
index e9516d3e119..78afe04d9b1 100644
--- a/engines/ags/engine/gfx/ali_3d_scummvm.h
+++ b/engines/ags/engine/gfx/ali_3d_scummvm.h
@@ -164,7 +164,7 @@ public:
return "Software";
}
const char *GetDriverName() override {
- return "SDL 2D Software renderer";
+ return "ScummVM 2D renderer";
}
void SetTintMethod(TintMethod /*method*/) override;
More information about the Scummvm-git-logs
mailing list