Skip to content

fix: avoid full rebuild by writing BuildVer.h only when content changes#1164

Open
MrTheShy wants to merge 4 commits intosmartcmd:mainfrom
MrTheShy:reduce-compile-time
Open

fix: avoid full rebuild by writing BuildVer.h only when content changes#1164
MrTheShy wants to merge 4 commits intosmartcmd:mainfrom
MrTheShy:reduce-compile-time

Conversation

@MrTheShy
Copy link
Contributor

@MrTheShy MrTheShy commented Mar 11, 2026

Description

Fix incremental builds being ignored — every build was triggering a full recompilation due to prebuild.ps1 unconditionally touching BuildVer.h.

Changes

Previous Behavior

Every build performed a full recompilation of all translation units, regardless of whether any source files had actually changed.

Root Cause

prebuild.ps1 used Set-Content to overwrite BuildVer.h on every build, updating its file timestamp even when the content was completely identical. Since BuildVer.h is included across many source files, MSBuild considered all of them out of date and recompiled everything from scratch.

New Behavior

Incremental builds work correctly. BuildVer.h is only written to disk if its content has actually changed (i.e. a new commit was made, the branch changed, or uncommitted changes appeared/disappeared). Unchanged builds skip the write entirely and leave the file timestamp untouched.

Fix Implementation

In prebuild.ps1, replaced the unconditional Set-Content call with a comparison between the newly generated content and the existing file content. The file is only written if the two differ.

AI Use Disclosure

No AI was used to write the code in this PR. The PR Message was done by ai

Previously, prebuild.ps1 unconditionally overwrote BuildVer.h on every
build using Set-Content, updating its timestamp even when the content
was identical. This caused MSBuild to treat all files depending on
BuildVer.h as out of date, triggering a full rebuild every time.

Fix: compare the new content with the existing file before writing.
BuildVer.h is now only written if sha, branch, or dev suffix has
actually changed.

Also removed the `git restore` call from postbuild.ps1 as it is no
longer needed.
Updated the safe zone calculations across multiple UI components to ensure symmetry in split viewports. Removed unnecessary assignments and added comments for clarity. Modified the repositionHud function to include an additional parameter for better handling of HUD positioning in split-screen scenarios.
The F3 debug screen was badly broken in splitscreen: it used the GUI
coordinate space which gets distorted by the splitscreen scaling, so
text appeared stretched, misaligned or completely off-screen depending
on the viewport layout.

Fixed by setting up a dedicated projection matrix using physical pixel
coordinates (g_rScreenWidth / g_rScreenHeight) each time the overlay is
drawn, completely decoupled from whatever transform the HUD is using.
The viewport dimensions are now computed per screen section so the ortho
projection matches the actual pixel area of each player's quadrant.
Version and branch strings are only shown for player 0 (iPad == 0) to
avoid repeating them across every splitscreen pane.

Also removed a few redundant calculations that were being done twice in
the same frame (atan for xRot, health halves, air supply scaled value).
These are minor and have negligible real-world impact; more substantial
per-frame caching work (safe zone calculations etc.) will follow in a
separate commit.
@MrTheShy
Copy link
Contributor Author

@codeHusky we should just add that file to gitignore and remove the removal of the file from postscript, wdyt?

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.

1 participant