Skip to content

Fix include case and MSVC-only constructs for other compilers - #67

Merged
smlu merged 4 commits into
smlu:developfrom
seelenkuchen:fix/include-path-case
Nov 8, 2026
Merged

smlu merged 4 commits into
smlu:developfrom
seelenkuchen:fix/include-path-case

Conversation

@seelenkuchen

Copy link
Copy Markdown

Small source fixes so the code also builds with compilers other than MSVC, and on hosts with case-sensitive file systems. None of them changes what MSVC builds.

Commits

  1. Fix include path case for case-sensitive hosts. 22 files include headers with a case that doesn't match the file on disk, such as sithCogexec.h for sithCogExec.h or sith/DSS/ for sith/Dss/. They also use Windows SDK names like Windows.h, Xinput.h and D3Dcommon.h in the capitalization MinGW doesn't ship. Windows ignores case, so MSVC doesn't notice. After this PR, a scan of every project include finds no mismatch.
  2. Fix Windows.h include case in byacc and flex. The same fix for the 2 build tools under Programs/.
  3. Make header and file-local inline functions static. In C99, a plain inline function needs an external definition in some other file. MSVC doesn't require one, but GCC does. None of these functions has one, is hooked, or has its address taken.
  4. Fix source constructs that only MSVC accepts.
    • Adds the missing assert.h and float.h includes.
    • Adds a GCC branch for the fnstcw in stdStartup. The MSVC __asm path is unchanged.
    • Uses LPDIRECT3DDEVICE9 in place of the same-typed PDIRECT3DDEVICE9.
    • Gives MERGE_TOKENS in common.hlsli a second level. Its argument (VS_CONSTANTS_START_<n>) is a macro, and standard preprocessing glues the unexpanded name with one level. With two levels it expands first, giving the intended c<n> register.

Validation

This was tested on my fork with a MinGW-w64 i686 build (GCC 13, DX9 Debug, under Wine 10). That build isn't part of this PR.

  • Passed: j3dcore.Macros 7/7, rdroid.Math 9/9, sound 37/37, smush 181 (1 ignored), sith 38/38, sith.DSS 32 (1 ignored). The fork has since run the full suite with these changes in place, also natively on Linux.
  • Known failures, unchanged by this PR: std 263/265 under MinGW/Wine (a stdConffile %a scan, and the __LINE__ value in a Printf message).
  • Not run: MSVC and Microsoft's FXC shader compiler (left to this repo's CI), DX6, Release, guard and QOL profiles.

The MERGE_TOKENS change is the one to watch in CI: it has been verified with Wine's shader compiler only.

Draft until CI has run.

@seelenkuchen
seelenkuchen marked this pull request as ready for review November 2, 2026 22:38

@smlu smlu 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.

Resolve conflicts with upstream

Include paths now match the case on disk, and Windows SDK headers use the lowercase names
MinGW ships. No effect on case-insensitive Windows builds.

Validation (whole series, MinGW-w64 i686 GCC 13, DX9 Debug, under Wine 10):
- Pass: j3dcore.Macros 7/7, rdroid.Math 9/9, sound 37/37, smush 181 + 1 ignored,
  sith 38/38, sith.DSS 32 + 1 ignored.
- Fail: std 263/265. stdConffile %a scan and the Printf __LINE__ text, both known from
  the toolchain trial.
- Not run: MSVC builds (not possible on this host), DX6, Release, guard and QOL profiles,
  std.System, the game itself. byacc does not build under MinGW (Windows.h case in
  Programs/byacc/main.c), so programs are off.
- Only the final commit of the series can be built with MinGW; earlier ones were not
  built individually.
Same as the engine includes: lowercase windows.h, the name MinGW and
case-sensitive hosts ship. No effect on MSVC.
C99 plain inline needs an external definition elsewhere, which MSVC does not require and GCC
does. None of these functions has one, is hooked, or has its address taken, per a repo search.
MSVC build of this change is unverified.

Validation (whole series, MinGW-w64 i686 GCC 13, DX9 Debug, under Wine 10):
- Pass: j3dcore.Macros 7/7, rdroid.Math 9/9, sound 37/37, smush 181 + 1 ignored,
  sith 38/38, sith.DSS 32 + 1 ignored.
- Fail: std 263/265. stdConffile %a scan and the Printf __LINE__ text, both known from
  the toolchain trial.
- Not run: MSVC builds (not possible on this host), DX6, Release, guard and QOL profiles,
  std.System, the game itself. byacc does not build under MinGW (Windows.h case in
  Programs/byacc/main.c), so programs are off.
- Only the final commit of the series can be built with MinGW; earlier ones were not
  built individually.
Adds missing assert.h and float.h includes, GCC syntax for the fnstcw in stdStartup, and
LPDIRECT3DDEVICE9 in place of the same-typed PDIRECT3DDEVICE9. MERGE_TOKENS gains a second
level so its arguments expand as the C preprocessor requires. That form is verified with Wine's
shader compiler only, not with Microsoft's FXC, and the MSVC build is unverified.

Validation (whole series, MinGW-w64 i686 GCC 13, DX9 Debug, under Wine 10):
- Pass: j3dcore.Macros 7/7, rdroid.Math 9/9, sound 37/37, smush 181 + 1 ignored,
  sith 38/38, sith.DSS 32 + 1 ignored.
- Fail: std 263/265. stdConffile %a scan and the Printf __LINE__ text, both known from
  the toolchain trial.
- Not run: MSVC builds (not possible on this host), DX6, Release, guard and QOL profiles,
  std.System, the game itself. byacc does not build under MinGW (Windows.h case in
  Programs/byacc/main.c), so programs are off.
- Only the final commit of the series can be built with MinGW; earlier ones were not
  built individually.
@seelenkuchen
seelenkuchen force-pushed the fix/include-path-case branch from 6ede0a4 to 1a3b872 Compare November 8, 2026 12:17
@seelenkuchen

Copy link
Copy Markdown
Author

Resolve conflicts with upstream

Done

@smlu
smlu merged commit 4a7ab72 into smlu:develop Nov 8, 2026
20 checks passed
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