Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Apr 2026 16:20:53 +0000
From:      Dmitry Marakasov <amdmi3@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: f8384dbc042a - main - games/openxcom: fix crash when loading Battlescape saves
Message-ID:  <69ef8ce5.45e6f.7eafe6f5@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by amdmi3:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f8384dbc042ac98afcfc06defabebe42c9a22445

commit f8384dbc042ac98afcfc06defabebe42c9a22445
Author:     Dmitry Marakasov <amdmi3@FreeBSD.org>
AuthorDate: 2026-02-25 22:05:18 +0000
Commit:     Dmitry Marakasov <amdmi3@FreeBSD.org>
CommitDate: 2026-04-27 16:20:47 +0000

    games/openxcom: fix crash when loading Battlescape saves
    
    Submitted by:   Lakitu Jakov <lj910424@gmail.com>
---
 games/openxcom/Makefile                            |  2 +-
 .../files/patch-src_Savegame_SavedBattleGame.cpp   | 46 ++++++++++++++++++++++
 2 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/games/openxcom/Makefile b/games/openxcom/Makefile
index 40f5ccb53451..2fbfacf42bdf 100644
--- a/games/openxcom/Makefile
+++ b/games/openxcom/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	openxcom
 PORTVERSION=	1.0
 DISTVERSIONPREFIX=	v
-PORTREVISION=	12
+PORTREVISION=	13
 CATEGORIES=	games
 
 MAINTAINER=	amdmi3@FreeBSD.org
diff --git a/games/openxcom/files/patch-src_Savegame_SavedBattleGame.cpp b/games/openxcom/files/patch-src_Savegame_SavedBattleGame.cpp
new file mode 100644
index 000000000000..6c1bbe6d363f
--- /dev/null
+++ b/games/openxcom/files/patch-src_Savegame_SavedBattleGame.cpp
@@ -0,0 +1,46 @@
+Corresponds to upstream commits 09f8473 and 7fe2dd9
+
+--- src/Savegame/SavedBattleGame.cpp.orig	2014-06-13 21:14:43 UTC
++++ src/Savegame/SavedBattleGame.cpp
+@@ -148,14 +148,14 @@
+ 		Tile::SerializationKey serKey;
+ 		size_t totalTiles = node["totalTiles"].as<size_t>();
+ 
+-        memset(&serKey, 0, sizeof(Tile::SerializationKey));
+-		serKey.index = node["tileIndexSize"].as<Uint8>(serKey.index);
++		memset(&serKey, 0, sizeof(Tile::SerializationKey));
++		serKey.index = node["tileIndexSize"].as<char>(serKey.index);
+ 		serKey.totalBytes = node["tileTotalBytesPer"].as<Uint32>(serKey.totalBytes);
+-		serKey._fire = node["tileFireSize"].as<Uint8>(serKey._fire);
+-		serKey._smoke = node["tileSmokeSize"].as<Uint8>(serKey._smoke);
+-		serKey._mapDataID = node["tileIDSize"].as<Uint8>(serKey._mapDataID);
+-		serKey._mapDataSetID = node["tileSetIDSize"].as<Uint8>(serKey._mapDataSetID);
+-		serKey.boolFields = node["tileBoolFieldsSize"].as<Uint8>(1); // boolean flags used to be stored in an unmentioned byte (Uint8) :|
++		serKey._fire = node["tileFireSize"].as<char>(serKey._fire);
++		serKey._smoke = node["tileSmokeSize"].as<char>(serKey._smoke);
++		serKey._mapDataID = node["tileIDSize"].as<char>(serKey._mapDataID);
++		serKey._mapDataSetID = node["tileSetIDSize"].as<char>(serKey._mapDataSetID);
++		serKey.boolFields = node["tileBoolFieldsSize"].as<char>(1); // boolean flags used to be stored in an unmentioned byte (Uint8) :|
+ 
+ 		// load binary tile data! 
+ 		YAML::Binary binTiles = node["binTiles"].as<YAML::Binary>();
+@@ -380,13 +380,13 @@
+ 	}
+ #else
+ 	// first, write out the field sizes we're going to use to write the tile data
+-	node["tileIndexSize"] = Tile::serializationKey.index;
++	node["tileIndexSize"] = static_cast<char>(Tile::serializationKey.index);
+ 	node["tileTotalBytesPer"] = Tile::serializationKey.totalBytes;
+-	node["tileFireSize"] = Tile::serializationKey._fire;
+-	node["tileSmokeSize"] = Tile::serializationKey._smoke;
+-	node["tileIDSize"] = Tile::serializationKey._mapDataID;
+-	node["tileSetIDSize"] = Tile::serializationKey._mapDataSetID;
+-    node["tileBoolFieldsSize"] = Tile::serializationKey.boolFields;
++	node["tileFireSize"] = static_cast<char>(Tile::serializationKey._fire);
++	node["tileSmokeSize"] = static_cast<char>(Tile::serializationKey._smoke);
++	node["tileIDSize"] = static_cast<char>(Tile::serializationKey._mapDataID);
++	node["tileSetIDSize"] = static_cast<char>(Tile::serializationKey._mapDataSetID);
++	node["tileBoolFieldsSize"] = static_cast<char>(Tile::serializationKey.boolFields);
+ 
+ 	size_t tileDataSize = Tile::serializationKey.totalBytes * _mapsize_z * _mapsize_y * _mapsize_x;
+ 	Uint8* tileData = (Uint8*) calloc(tileDataSize, 1);


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69ef8ce5.45e6f.7eafe6f5>