Skip to content

build(windows): restore deterministic x86 build - #253

Open
arazmj wants to merge 1 commit into
fbraz3:mainfrom
arazmj:fix/windows-deterministic-x86
Open

build(windows): restore deterministic x86 build#253
arazmj wants to merge 1 commit into
fbraz3:mainfrom
arazmj:fix/windows-deterministic-x86

Conversation

@arazmj

@arazmj arazmj commented Aug 15, 2026

Copy link
Copy Markdown

Description

Restore the experimental native MSVC x86 Zero Hour build and enable the same
fdlibm-backed deterministic math path used by Linux and macOS.

The previous modern Windows path referenced moved Win32 sources, exposed POSIX
compatibility headers ahead of Windows SDK headers, omitted native runtime
implementations, and did not link the native D3DX library. This prevented the
placeholder workflow from producing a usable executable.

Changes

  • restore native Win32, DirectInput, DirectX 8, Miles, Bink, and VFW sources
  • isolate POSIX compatibility headers from native Windows builds
  • repair modern MSVC include, Winsock, COM, and release-warning failures
  • enable deterministic GameMath with /fp:precise for Windows x86
  • add Windows build and replay jobs to the main CI workflow
  • validate all Linux- and macOS-recorded replay captures on Windows
  • use a protected cross-OS asset cache so fork PRs never receive asset secrets
  • standardize new replay wide characters on retail UTF-16 while reading legacy Unix UTF-32 captures
  • publish generalsxzh-windows-x86 as the user-facing artifact with the executable, symbols, zlib runtime, and installation instructions
  • publish generalsxzh-windows-x86-replay-test-only solely for headless CI, with generated Miles/Bink stubs but no symbols
  • preserve the licensed installation's retail mss32.dll and binkw32.dll

Validation

  • built the complete Release target with MSVC 2022 x86
  • verified the executable is PE32 Intel 80386 and contains the fdlibm GameMath object code
  • passed the full Linux, macOS, and Windows build/replay matrix in CI run 32174294450
  • required all six Windows simulations to report matching current/total game times at their recorded final frames
  • built the Generals and Zero Hour macOS recorder targets locally
  • launched successfully from a Steam Zero Hour installation
  • completed a real macOS ARM64 and Windows x86 multiplayer match without a synchronization error
  • confirmed Windows audio works when retaining the installation's retail Miles and Bink DLLs

@fbraz3

fbraz3 commented Aug 15, 2026

Copy link
Copy Markdown
Owner

hey @arazmj do you have a discord account so we can talk about the implementation? thanks!

@arazmj

arazmj commented Aug 15, 2026

Copy link
Copy Markdown
Author

Additional real-world validation: completed another multiplayer game with two macOS GeneralsX clients and one deterministic Windows client. Map loading, shared tunnel exits, sound, and synchronization all remained working with no reported problems.

@fbraz3

fbraz3 commented Aug 16, 2026

Copy link
Copy Markdown
Owner

A Windows build seems to be a good idea, could you please:

  • Resolve branch conflicts
  • Add windows build to CI process, validating both mac and linux replays under windows environment.

Thanks!

@arazmj
arazmj force-pushed the fix/windows-deterministic-x86 branch from d57224e to c91b0de Compare August 16, 2026 14:26
@arazmj

arazmj commented Aug 16, 2026

Copy link
Copy Markdown
Author

Addressed both requests: the branch is rebased onto current main and mergeable, and CI now builds MSVC x86 Zero Hour then plays every Linux- and macOS-recorded replay on Windows. Implementing the matrix exposed and fixed a real replay-format issue: Unix had serialized wchar_t as UTF-32 while Windows expected retail UTF-16; new captures now use fixed UTF-16 and older Unix captures are detected and read compatibly. Fork PR assets are transferred through a protected cross-OS cache without exposing secrets, and CI-only Miles/Bink stubs remain separate from distributable artifacts. Full matrix is green: https://github.com/fbraz3/GeneralsX/actions/runs/31956737144

@fbraz3

fbraz3 commented Aug 16, 2026

Copy link
Copy Markdown
Owner

thanks for adress the issues.

Just a few more questions.

  • Is there any particular reason to split the windows replay test in a different file?
  • I saw 2 artifacts being generated for windows, which one is the correct?
    • generalsxzh-windows-x86-ci | 2.86 MB
    • generalsxzh-windows-x86 | 19 MB

I'm also found a diference on windows replay tests, if you refer to linux or mac replay tests you will find lines like this at end of logs for all replay files:

Simulating Replay "/home/runner/.local/share/GeneralsX/GeneralsZH/Replays/linux_2p_custom_map.rep"
[GeneralsX] Replay map resolved via CRC fallback: CRC=0x43396DD8 size=162490 -> '/home/runner/.var/app/com.fbraz3.generalsxzh/data/generalsx/generalszh/maps/[rank] arctic arena zh v1/[rank] arctic arena zh v1.map'
INFO: OSDisplaySetBusyState(false, true) - Linux stub
[INI] load('/home/runner/.var/app/com.fbraz3.generalsxzh/data/generalsx/generalszh/maps/[rank] arctic arena zh v1\map.ini') START
[INI] load - calling prepFile('/home/runner/.var/app/com.fbraz3.generalsxzh/data/generalsx/generalszh/maps/[rank] arctic arena zh v1\map.ini') START
[INI] load - prepFile completed
[INI] load - processed total 17 lines
[INI] load('/home/runner/.var/app/com.fbraz3.generalsxzh/data/generalsx/generalszh/maps/[rank] arctic arena zh v1\map.ini') END
INFO: OSDisplaySetBusyState(false, true) - Linux stub
Elapsed Time: 00:00 Game Time: 07:10/07:10

But on windows headless replay test the log ends early, so it seems the replay test itself is not running.

[INI] load('c:\users\runneradmin\documents\command and conquer generals zero hour data\maps\[rank] arctic arena zh v1\map.ini') START
[INI] load - calling prepFile('c:\users\runneradmin\documents\command and conquer generals zero hour data\maps\[rank] arctic arena zh v1\map.ini') START
[INI] load - prepFile completed
[INI] load - processed total 17 lines
[INI] load('c:\users\runneradmin\documents\command and conquer generals zero hour data\maps\[rank] arctic arena zh v1\map.ini') END

@arazmj
arazmj force-pushed the fix/windows-deterministic-x86 branch from 5746393 to f7b510a Compare August 18, 2026 19:01
@arazmj

arazmj commented Aug 18, 2026

Copy link
Copy Markdown
Author

@fbraz3 Addressed in f7b510a57.

  • I kept the Windows replay runner separate because it is a reusable workflow with a different runner, PowerShell implementation, 32-bit registry setup, runtime layout, and protected cross-OS asset restoration. Putting that path into the Unix replay workflow would add a large Windows-only branch to an already platform-conditioned shell workflow; both remain wired into the same ci.yml summary.
  • generalsxzh-windows-x86 is the correct user-facing artifact. It contains the executable, PDB, zlib runtime, and installation instructions and must be copied into an existing licensed Zero Hour installation while retaining its retail Miles/Bink DLLs. I renamed the smaller internal artifact to generalsxzh-windows-x86-replay-test-only; it omits symbols and contains generated Miles/Bink stubs solely so the headless CI process can load. The PR description now documents both explicitly.
  • You were right that the Windows output looked incomplete. The process captured stdout and stderr separately, then printed the final stdout simulation line before thousands of stderr diagnostics, so the visible tail ended at map.ini. The workflow now prints diagnostics first, leaves the final simulation line visible, and requires a matching final current/total game-time marker instead of accepting exit code zero alone.

The corrected CI run 32174294450 passed the full matrix. All six Windows simulations reached their recorded final frame:

linux_2p_custom_map.rep  07:10/07:10
linux_2p_vanilla_map.rep 06:38/06:38
linux_6p_custom_map.rep   14:39/14:39
macos_2p_custom_map.rep  08:39/08:39
macos_2p_vanilla_map.rep 06:07/06:07
macos_6p_custom_map.rep   12:15/12:15

@fbraz3 fbraz3 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Could you please update the code and squash commits?

After that we are good to go.

Comment thread .github/workflows/ci.yml Outdated
Restore the native MSVC build, add independent cross-platform replay validation, and standardize replay wide-character serialization for Windows compatibility.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@arazmj
arazmj force-pushed the fix/windows-deterministic-x86 branch from f7b510a to 4b78203 Compare August 19, 2026 01:48
@arazmj

arazmj commented Aug 19, 2026

Copy link
Copy Markdown
Author

Addressed review 4966775852: removed the unnecessary Linux replay dependency from the Windows replay job and squashed the branch into commit 4b782036c. The full build/replay matrix passed in CI run 32206271572.

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