git: e9034acc7ae5 - main - games/CWR-CE: roll upstream fork forward and fix aarch64 build

From: Olivier Cochard <olivier_at_FreeBSD.org>
Date: Mon, 06 Jul 2026 21:48:24 UTC
The branch main has been updated by olivier:

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

commit e9034acc7ae561553a02d2fb263953ac2e73d1fe
Author:     Olivier Cochard <olivier@FreeBSD.org>
AuthorDate: 2026-07-06 21:46:43 +0000
Commit:     Olivier Cochard <olivier@FreeBSD.org>
CommitDate: 2026-07-06 21:47:46 +0000

    games/CWR-CE: roll upstream fork forward and fix aarch64 build
---
 games/CWR-CE/Makefile                              |  12 ++-
 games/CWR-CE/distinfo                              |   6 +-
 .../files/patch-engine_Poseidon_AI_AIGroupImpl.cpp | 118 ---------------------
 ...tch-engine_Poseidon_Foundation_Math_Quatrix.hpp |  17 +++
 ...h-engine_Poseidon_Foundation_Math_V3QuadsP3.cpp |  18 ++++
 ...-engine_Poseidon_Graphics_Rendering_ColorsK.hpp |  14 +++
 .../patch-engine_Poseidon_UI_OptionsUIApp.cpp      |  11 ++
 ...idon_World_Entities_Infantry_SoldierOldMove.cpp |  15 ---
 ..._Poseidon_World_Entities_Vehicles_Transport.cpp |  16 ---
 ...eidon_World_Entities_Vehicles_TransportCore.cpp |  39 -------
 10 files changed, 72 insertions(+), 194 deletions(-)

diff --git a/games/CWR-CE/Makefile b/games/CWR-CE/Makefile
index 40bc1ff79861..1ad30a6e89a9 100644
--- a/games/CWR-CE/Makefile
+++ b/games/CWR-CE/Makefile
@@ -1,11 +1,11 @@
 PORTNAME=	CWR-CE
 DISTVERSIONPREFIX=	v
 DISTVERSION=	3.01
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	games
 
 PATCH_SITES=	https://github.com/ocochard/CWR-CE/compare/
-PATCHFILES=	9abbdf2769f3008d76c47ac0af219388ff0323dc..55e703228bf5649a6a847d724e94b97d94d7057f.patch:-p1
+PATCHFILES=	9abbdf2769f3008d76c47ac0af219388ff0323dc..8fc693b2c6f85929e43975ef04df28818e740dba.patch:-p1
 
 MAINTAINER=	olivier@FreeBSD.org
 COMMENT=	Arma: Cold War Assault - Remastered Community Edition
@@ -76,4 +76,10 @@ do-install:
 	${INSTALL_SCRIPT} ${FILESDIR}/cwr-ce.sh \
 		${STAGEDIR}${PREFIX}/bin/cwr-ce
 
-.include <bsd.port.mk>
+.include <bsd.port.pre.mk>
+
+.if ${ARCH} == aarch64
+BUILD_DEPENDS+=	${LOCALBASE}/include/sse2neon.h:devel/sse2neon
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/games/CWR-CE/distinfo b/games/CWR-CE/distinfo
index 290b2c2de3e3..655d5332bf55 100644
--- a/games/CWR-CE/distinfo
+++ b/games/CWR-CE/distinfo
@@ -1,5 +1,5 @@
-TIMESTAMP = 1783002492
+TIMESTAMP = 1783120623
 SHA256 (ofpisnotdead-com-CWR-CE-v3.01-9abbdf2769f3008d76c47ac0af219388ff0323dc_GH0.tar.gz) = 87df6297ed74993d56d3ceec9d90fb9287cebc58f47030a285a2eafb61c3ce22
 SIZE (ofpisnotdead-com-CWR-CE-v3.01-9abbdf2769f3008d76c47ac0af219388ff0323dc_GH0.tar.gz) = 4944610
-SHA256 (9abbdf2769f3008d76c47ac0af219388ff0323dc..55e703228bf5649a6a847d724e94b97d94d7057f.patch) = c744b9b9bf7b1917ac159b8af41cfe354d2f8e646eb7b6722953f56583053df8
-SIZE (9abbdf2769f3008d76c47ac0af219388ff0323dc..55e703228bf5649a6a847d724e94b97d94d7057f.patch) = 41794
+SHA256 (9abbdf2769f3008d76c47ac0af219388ff0323dc..8fc693b2c6f85929e43975ef04df28818e740dba.patch) = f460898cb4066ceb712c021154eb9eebd8aed71b88627864fa28de52466b2a7d
+SIZE (9abbdf2769f3008d76c47ac0af219388ff0323dc..8fc693b2c6f85929e43975ef04df28818e740dba.patch) = 75285
diff --git a/games/CWR-CE/files/patch-engine_Poseidon_AI_AIGroupImpl.cpp b/games/CWR-CE/files/patch-engine_Poseidon_AI_AIGroupImpl.cpp
deleted file mode 100644
index 9c4ce16cee2e..000000000000
--- a/games/CWR-CE/files/patch-engine_Poseidon_AI_AIGroupImpl.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-diff --git engine/Poseidon/AI/AIGroupImpl.cpp engine/Poseidon/AI/AIGroupImpl.cpp
-index eeaffd9..22d895b 100644
---- engine/Poseidon/AI/AIGroupImpl.cpp
-+++ engine/Poseidon/AI/AIGroupImpl.cpp
-@@ -41,6 +41,22 @@ namespace Poseidon
- {
- using namespace Foundation;
- 
-+// Diagnostic for msgCmd->GetFrom() == this invariant violations in the radio
-+// queue scans below. Returns the result of the check so call sites can be
-+// written as `if (!CheckMsgCmdFrom(...)) continue;` in future patches.
-+static bool CheckMsgCmdFrom(const AIGroup* self, RadioMessageCommand* msgCmd, const char* callSite)
-+{
-+    if (msgCmd->GetFrom() == self)
-+    {
-+        return true;
-+    }
-+    LOG_ERROR(AI, "AIGroup radio queue holds foreign command at {}: this={} ({}), from={} ({}), msgType={}", callSite,
-+              self ? (const char*)self->GetDebugName() : "null", (const void*)self,
-+              msgCmd->GetFrom() ? (const char*)msgCmd->GetFrom()->GetDebugName() : "null",
-+              (const void*)msgCmd->GetFrom(), msgCmd->GetType());
-+    return false;
-+}
-+
- // Parameters
- 
- bool AIGroup::CommandSent(bool channelCenter)
-@@ -72,7 +88,10 @@ bool AIGroup::CommandSent(bool channelCenter)
-         AI_ERROR(dynamic_cast<RadioMessageCommand*>(msg));
-         RadioMessageCommand* msgCmd = static_cast<RadioMessageCommand*>(msg);
-         AI_ERROR(msgCmd);
--        AI_ERROR(msgCmd->GetFrom() == this);
-+        if (!channelCenter)
-+        {
-+            CheckMsgCmdFrom(this, msgCmd, "CommandSent(bool)/FindPrevMessage");
-+        }
-         if (msgCmd->IsToMainSubgroup())
-         {
-             return true;
-@@ -86,7 +105,10 @@ bool AIGroup::CommandSent(bool channelCenter)
-         AI_ERROR(dynamic_cast<RadioMessageCommand*>(msg));
-         RadioMessageCommand* msgCmd = static_cast<RadioMessageCommand*>(msg);
-         AI_ERROR(msgCmd);
--        AI_ERROR(msgCmd->GetFrom() == this);
-+        if (!channelCenter)
-+        {
-+            CheckMsgCmdFrom(this, msgCmd, "CommandSent(bool)/GetActualMessage");
-+        }
-         if (msgCmd->IsToMainSubgroup())
-         {
-             return true;
-@@ -139,7 +161,10 @@ bool AIGroup::CommandSent(Command::Message message, bool channelCenter)
-         AI_ERROR(dynamic_cast<RadioMessageCommand*>(msg));
-         RadioMessageCommand* msgCmd = static_cast<RadioMessageCommand*>(msg);
-         AI_ERROR(msgCmd);
--        AI_ERROR(msgCmd->GetFrom() == this);
-+        if (!channelCenter)
-+        {
-+            CheckMsgCmdFrom(this, msgCmd, "CommandSent(msg,bool)/FindPrevMessage");
-+        }
-         if (msgCmd->GetCmdMessage() == message)
-         {
-             return true;
-@@ -152,7 +177,10 @@ bool AIGroup::CommandSent(Command::Message message, bool channelCenter)
-         AI_ERROR(dynamic_cast<RadioMessageCommand*>(msg));
-         RadioMessageCommand* msgCmd = static_cast<RadioMessageCommand*>(msg);
-         AI_ERROR(msgCmd);
--        AI_ERROR(msgCmd->GetFrom() == this);
-+        if (!channelCenter)
-+        {
-+            CheckMsgCmdFrom(this, msgCmd, "CommandSent(msg,bool)/GetActualMessage");
-+        }
-         if (msgCmd->GetCmdMessage() == message)
-         {
-             return true;
-@@ -200,7 +228,10 @@ bool AIGroup::CommandSent(AIUnit* to, Command::Message message, bool channelCent
-         AI_ERROR(dynamic_cast<RadioMessageCommand*>(msg));
-         RadioMessageCommand* msgCmd = static_cast<RadioMessageCommand*>(msg);
-         AI_ERROR(msgCmd);
--        AI_ERROR(msgCmd->GetFrom() == this);
-+        if (!channelCenter)
-+        {
-+            CheckMsgCmdFrom(this, msgCmd, "CommandSent(to,msg,bool)/FindPrevMessage");
-+        }
-         if (msgCmd->IsTo(to) && msgCmd->GetCmdMessage() == message)
-         {
-             return true;
-@@ -213,7 +244,10 @@ bool AIGroup::CommandSent(AIUnit* to, Command::Message message, bool channelCent
-         AI_ERROR(dynamic_cast<RadioMessageCommand*>(msg));
-         RadioMessageCommand* msgCmd = static_cast<RadioMessageCommand*>(msg);
-         AI_ERROR(msgCmd);
--        AI_ERROR(msgCmd->GetFrom() == this);
-+        if (!channelCenter)
-+        {
-+            CheckMsgCmdFrom(this, msgCmd, "CommandSent(to,msg,bool)/GetActualMessage");
-+        }
-         if (msgCmd->IsTo(to) && msgCmd->GetCmdMessage() == message)
-         {
-             return true;
-@@ -237,7 +271,7 @@ void AIGroup::ClearGetInCommands(AIUnit* to)
-         AI_ERROR(dynamic_cast<RadioMessageCommand*>(msg));
-         RadioMessageCommand* msgCmd = static_cast<RadioMessageCommand*>(msg);
-         AI_ERROR(msgCmd);
--        AI_ERROR(msgCmd->GetFrom() == this);
-+        CheckMsgCmdFrom(this, msgCmd, "ClearGetInCommands/FindPrevMessage");
-         if (msgCmd->IsTo(to) && msgCmd->GetCmdMessage() == Command::GetIn &&
-             (msgCmd->GetContext() == Command::CtxAuto || msgCmd->GetContext() == Command::CtxAutoSilent))
-         {
-@@ -252,8 +286,7 @@ void AIGroup::ClearGetInCommands(AIUnit* to)
-         AI_ERROR(dynamic_cast<RadioMessageCommand*>(msg));
-         RadioMessageCommand* msgCmd = static_cast<RadioMessageCommand*>(msg);
-         AI_ERROR(msgCmd);
--        AI_ERROR(msgCmd->GetFrom() == this);
--        AI_ERROR(msgCmd->GetFrom() == this);
-+        CheckMsgCmdFrom(this, msgCmd, "ClearGetInCommands/GetActualMessage");
-         if (msgCmd->IsTo(to) && msgCmd->GetCmdMessage() == Command::GetIn &&
-             (msgCmd->GetContext() == Command::CtxAuto || msgCmd->GetContext() == Command::CtxAutoSilent))
-         {
diff --git a/games/CWR-CE/files/patch-engine_Poseidon_Foundation_Math_Quatrix.hpp b/games/CWR-CE/files/patch-engine_Poseidon_Foundation_Math_Quatrix.hpp
new file mode 100644
index 000000000000..f8d12f18b07d
--- /dev/null
+++ b/games/CWR-CE/files/patch-engine_Poseidon_Foundation_Math_Quatrix.hpp
@@ -0,0 +1,17 @@
+--- engine/Poseidon/Foundation/Math/Quatrix.hpp.orig
++++ engine/Poseidon/Foundation/Math/Quatrix.hpp
+@@ -1,10 +1,14 @@
+ #pragma once
+
++#ifdef __aarch64__
++#include <sse2neon.h>
++#else
+ #ifdef _MSC_VER
+ #include <intrin.h>
+ #else
+ #include <xmmintrin.h>
+ #endif
++#endif
+
+ namespace Poseidon::Foundation
+ {
diff --git a/games/CWR-CE/files/patch-engine_Poseidon_Foundation_Math_V3QuadsP3.cpp b/games/CWR-CE/files/patch-engine_Poseidon_Foundation_Math_V3QuadsP3.cpp
new file mode 100644
index 000000000000..3174dc07d403
--- /dev/null
+++ b/games/CWR-CE/files/patch-engine_Poseidon_Foundation_Math_V3QuadsP3.cpp
@@ -0,0 +1,18 @@
+--- engine/Poseidon/Foundation/Math/V3QuadsP3.cpp.orig
++++ engine/Poseidon/Foundation/Math/V3QuadsP3.cpp
+@@ -7,11 +7,15 @@
+ #include <Poseidon/Foundation/Math/V3Quads.hpp>
+ #include <Poseidon/Graphics/Core/TLVertex.hpp>
+ #include <Poseidon/Foundation/Math/Math3D.hpp>
++#ifdef __aarch64__
++#include <sse2neon.h>
++#else
+ #ifdef _MSC_VER
+ #include <intrin.h> // For MMX intrinsics
+ #else
+ #include <x86intrin.h>
+ #endif
++#endif
+
+ #if defined __ICL
+ #define _COMPILER_CAN_PIII 1
diff --git a/games/CWR-CE/files/patch-engine_Poseidon_Graphics_Rendering_ColorsK.hpp b/games/CWR-CE/files/patch-engine_Poseidon_Graphics_Rendering_ColorsK.hpp
new file mode 100644
index 000000000000..378e6a5abbd3
--- /dev/null
+++ b/games/CWR-CE/files/patch-engine_Poseidon_Graphics_Rendering_ColorsK.hpp
@@ -0,0 +1,14 @@
+--- engine/Poseidon/Graphics/Rendering/ColorsK.hpp.orig
++++ engine/Poseidon/Graphics/Rendering/ColorsK.hpp
+@@ -2,7 +2,11 @@
+ int toInt(float fval);
+ int toInt(double f);
+
++#ifdef __aarch64__
++#include <sse2neon.h>
++#else
+ #include <xmmintrin.h>
++#endif
+ #include <Poseidon/Foundation/platform.hpp>
+ #include <Poseidon/Foundation/Math/MathDefs.hpp>
+
diff --git a/games/CWR-CE/files/patch-engine_Poseidon_UI_OptionsUIApp.cpp b/games/CWR-CE/files/patch-engine_Poseidon_UI_OptionsUIApp.cpp
new file mode 100644
index 000000000000..56222be713a7
--- /dev/null
+++ b/games/CWR-CE/files/patch-engine_Poseidon_UI_OptionsUIApp.cpp
@@ -0,0 +1,11 @@
+--- engine/Poseidon/UI/OptionsUIApp.cpp.orig
++++ engine/Poseidon/UI/OptionsUIApp.cpp
+@@ -120,6 +120,8 @@
+ {
+ #if defined(_M_X64) || defined(__x86_64__)
+     const char* platform = "x64";
++#elif defined(__aarch64__)
++    const char* platform = "aarch64";
+ #else
+     const char* platform = "x86";
+ #endif
diff --git a/games/CWR-CE/files/patch-engine_Poseidon_World_Entities_Infantry_SoldierOldMove.cpp b/games/CWR-CE/files/patch-engine_Poseidon_World_Entities_Infantry_SoldierOldMove.cpp
deleted file mode 100644
index 0997c5ae7df3..000000000000
--- a/games/CWR-CE/files/patch-engine_Poseidon_World_Entities_Infantry_SoldierOldMove.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git engine/Poseidon/World/Entities/Infantry/SoldierOldMove.cpp engine/Poseidon/World/Entities/Infantry/SoldierOldMove.cpp
-index 87c660d..7ac63e8 100644
---- engine/Poseidon/World/Entities/Infantry/SoldierOldMove.cpp
-+++ engine/Poseidon/World/Entities/Infantry/SoldierOldMove.cpp
-@@ -1006,7 +1006,9 @@ namespace Poseidon
- 
- void Man::KilledBy(EntityAI* owner)
- {
--    PoseidonAssert(_brain);
-+    // _brain is null on respawn transfer (NetworkClient.cpp moves the brain
-+    // to the new Soldier and nulls the old body's brain). A brainless
-+    // corpse taking damage lands here; nothing to do.
-     if (!_brain)
-     {
-         return;
diff --git a/games/CWR-CE/files/patch-engine_Poseidon_World_Entities_Vehicles_Transport.cpp b/games/CWR-CE/files/patch-engine_Poseidon_World_Entities_Vehicles_Transport.cpp
deleted file mode 100644
index 7910fd3863ec..000000000000
--- a/games/CWR-CE/files/patch-engine_Poseidon_World_Entities_Vehicles_Transport.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-diff --git engine/Poseidon/World/Entities/Vehicles/Transport.cpp engine/Poseidon/World/Entities/Vehicles/Transport.cpp
-index eb2d624..44da61b 100644
---- engine/Poseidon/World/Entities/Vehicles/Transport.cpp
-+++ engine/Poseidon/World/Entities/Vehicles/Transport.cpp
-@@ -1591,7 +1591,10 @@ void VehicleSupply::SupplyStarted(AIUnit* unit)
- {
-     LOG_DEBUG(Physics, "{} SupplyStarted for {}", (const char*)GetDebugName(), (const char*)unit->GetDebugName());
- 
--    PoseidonAssert(_supplyUnits.Find(unit) < 0);
-+    // A re-entry of the supply FSM state (e.g. Supply->Move->Supply when the
-+    // client drifts out of range and comes back) can call SupplyStarted for
-+    // a unit that never emitted a matching SupplyFinished. AddUnique below
-+    // handles the duplicate; the assert is stale.
-     _supplyUnits.AddUnique(unit);
- }
- 
diff --git a/games/CWR-CE/files/patch-engine_Poseidon_World_Entities_Vehicles_TransportCore.cpp b/games/CWR-CE/files/patch-engine_Poseidon_World_Entities_Vehicles_TransportCore.cpp
deleted file mode 100644
index 18575224684a..000000000000
--- a/games/CWR-CE/files/patch-engine_Poseidon_World_Entities_Vehicles_TransportCore.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-diff --git engine/Poseidon/World/Entities/Vehicles/TransportCore.cpp engine/Poseidon/World/Entities/Vehicles/TransportCore.cpp
-index df48f09..c6fb37b 100644
---- engine/Poseidon/World/Entities/Vehicles/TransportCore.cpp
-+++ engine/Poseidon/World/Entities/Vehicles/TransportCore.cpp
-@@ -350,7 +350,8 @@ void Transport::DammageCrew(EntityAI* killer, float howMuch, RString ammo)
-         }
-         if (CrewDammage(this, man, killer, howMuch, ammo))
-         {
--            if (man)
-+            // Skip brainless corpses (post-respawn bodies still riding as cargo).
-+            if (man && man->Brain())
-             {
-                 man->KilledBy(killer);
-             }
-@@ -358,21 +359,21 @@ void Transport::DammageCrew(EntityAI* killer, float howMuch, RString ammo)
-     }
-     if (CrewDammage(this, _driver, killer, howMuch, ammo))
-     {
--        if (_driver)
-+        if (_driver && _driver->Brain())
-         {
-             _driver->KilledBy(killer);
-         }
-     }
-     if (CrewDammage(this, _gunner, killer, howMuch, ammo))
-     {
--        if (_gunner)
-+        if (_gunner && _gunner->Brain())
-         {
-             _gunner->KilledBy(killer);
-         }
-     }
-     if (CrewDammage(this, _commander, killer, howMuch, ammo))
-     {
--        if (_commander)
-+        if (_commander && _commander->Brain())
-         {
-             _commander->KilledBy(killer);
-         }