Fix Generals Linux shell map disable and skirmish FontChars SIGSEGV - #26
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses Linux/base-Generals stability and feature regressions by restoring sensible hardware defaults for LOD gating (preventing shell map disable), fixing 64-bit safety in listbox item payloads, and hardening shared font glyph indexing against non-Windows wchar_t/packed UTF-16-like values that caused skirmish UI crashes. It also logs the work in the March 2026 development diary.
Changes:
- Add non-Windows hardware fallback values in
GameLODManager::init()to prevent shell map disable when Windows-only probes return zeros. - Make battle honor listbox item-data storage use a 64-bit-safe int↔pointer cast.
- Normalize
WCHARto 16-bit code units inFontCharsClass::Get_Char_Data()before unicode array growth/indexing to prevent out-of-range access.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| docs/DEV_BLOG/2026-03-DIARY.md | Adds Session 82 notes describing the shell map + skirmish crash fixes and validation. |
| Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp | Updates listbox item-data cast to be safe on 64-bit builds. |
| Generals/Code/GameEngine/Source/Common/GameLOD.cpp | Adds non-Windows fallback CPU/RAM values after requirement probing to avoid false min-spec failures. |
| Core/Libraries/Source/WWVegas/WW3D2/render2dsentence.cpp | Normalizes incoming WCHAR to 16-bit before unicode glyph array indexing to prevent SIGSEGV. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes two Linux/64-bit stability issues in base Generals (shell map erroneously disabled; skirmish UI crash in font rendering) while keeping behavior aligned with the engine’s legacy 16-bit glyph indexing assumptions, and records the work in the March 2026 dev diary.
Changes:
- Add non-Windows fallback defaults in
GameLODManager::init()when hardware detection returns zero/unknown values (prevents shell map being disabled). - Make listbox item-data storage 64-bit safe by casting via
intptr_tin the battle honor popup. - Prevent skirmish SIGSEGV in
FontCharsClass::Get_Char_Data()by normalizing incomingWCHARto 16-bit code units before Unicode array growth/indexing. - Add a dev diary entry for the session.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Core/Libraries/Source/WWVegas/WW3D2/render2dsentence.cpp | Normalizes WCHAR to 16-bit prior to font array access to avoid out-of-range indexing on platforms with 32-bit wchar_t. |
| Generals/Code/GameEngine/Source/Common/GameLOD.cpp | Applies non-Windows fallback CPU/RAM defaults only when detection fails (zero/unknown), restoring expected shell map behavior. |
| Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp | Updates listbox item-data cast to be 64-bit safe via intptr_t. |
| docs/DEV_BLOG/2026-03-DIARY.md | Adds March 2026 session notes documenting the fixes and validation. |
Summary
GameLODinit so shell map is not disabled when Windows-only requirement probe returns zeroesWCHARto 16-bit code units before unicode font array growth/indexingRoot Cause
User-provided GDB trace crashed in
FontCharsClass::Get_Char_Spacingduring skirmish menu init (SkirmishGameOptionsMenuInit).On Linux,
wchar_tis 32-bit and text could arrive with packed UTF-16-like values, which could drive out-of-range unicode array indexing inGet_Char_Data.Files Changed
Core/Libraries/Source/WWVegas/WW3D2/render2dsentence.cppGenerals/Code/GameEngine/Source/Common/GameLOD.cppGenerals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cppdocs/DEV_BLOG/2026-03-DIARY.mdValidation