Skip to content

Fix Generals Linux shell map disable and skirmish FontChars SIGSEGV - #26

Merged
fbraz3 merged 2 commits into
mainfrom
fix/generals-skirmish-fontchars-linux
Mar 15, 2026
Merged

Fix Generals Linux shell map disable and skirmish FontChars SIGSEGV#26
fbraz3 merged 2 commits into
mainfrom
fix/generals-skirmish-fontchars-linux

Conversation

@fbraz3

@fbraz3 fbraz3 commented Mar 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • restore Linux hardware fallback in base Generals GameLOD init so shell map is not disabled when Windows-only requirement probe returns zeroes
  • make skirmish battle honor list item data cast 64-bit safe in base Generals popup menu
  • fix root cause of skirmish crash in shared text renderer by normalizing incoming WCHAR to 16-bit code units before unicode font array growth/indexing
  • update March 2026 dev diary with session notes

Root Cause

User-provided GDB trace crashed in FontCharsClass::Get_Char_Spacing during skirmish menu init (SkirmishGameOptionsMenuInit).
On Linux, wchar_t is 32-bit and text could arrive with packed UTF-16-like values, which could drive out-of-range unicode array indexing in Get_Char_Data.

Files Changed

  • Core/Libraries/Source/WWVegas/WW3D2/render2dsentence.cpp
  • Generals/Code/GameEngine/Source/Common/GameLOD.cpp
  • Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp
  • docs/DEV_BLOG/2026-03-DIARY.md

Validation

  • static analysis reports no errors in changed C++ files
  • user confirmed skirmish click path works after fix

Copilot AI review requested due to automatic review settings March 14, 2026 22:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 WCHAR to 16-bit code units in FontCharsClass::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.

Comment thread Generals/Code/GameEngine/Source/Common/GameLOD.cpp Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 15, 2026 13:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_t in the battle honor popup.
  • Prevent skirmish SIGSEGV in FontCharsClass::Get_Char_Data() by normalizing incoming WCHAR to 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.

@fbraz3
fbraz3 merged commit 040a40b into main Mar 15, 2026
9 checks passed
@fbraz3
fbraz3 deleted the fix/generals-skirmish-fontchars-linux branch March 22, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants