Repository navigation
feat(bsp): add CheckBSP to validate version 30 brush files before an engine parses them - #3
Merged
Merged
Conversation
…engine parses them Appends CheckBSP to UtilAssetsIntegrityAPI_001 with the lump layout (GoldSrc or Blue Shift) and the caller's leaf capacity. It checks lump ranges and record sizes, every cross-reference as the GoldSrc engine reads it, embedded miptex data, the light samples and visibility rows the engine reads, and acyclic, bounded node and clipnode graphs. A scan of 496 installed brush files shaped the rules: clipping heads at the clipnode count, visibility runs past the engine row, offset 0 without lighting or visibility, and unterminated entities are accepted, as stock maps need them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
CheckBSP(buf, bufSize, layout, result), appended toUtilAssetsIntegrityAPI_001afterCheckStudioSequenceGroup(); the existing vtable slots and result layouts are unchanged. It validates a version 30 brush file before an engine parses it (requested by HLND2T/HLND2T-DiligentGraphics#533).UtilAssetsIntegrityBSPLayout(GoldSrc / Blue Shift) is passed by the caller, as engines pick it by game.UtilAssetsIntegrityCheckResult_BSP::MaxLeafsbounds the leaf count with the caller's PVS capacity (zero enforced, null result skips it, as with the BMP limits).src/BSPValidation.hreads records at fixed offsets and fields as the GoldSrc engine reads them. It checks:GL_LoadTexturereads;CalcSurfaceExtentscomputes them;RecursiveLightPoint/R_BuildLightMapread;CM_DecompressPVSdecodes them;docs/bsp-validation.md.Stock map scan
Scanned 496 installed brush files (valve, bshift, gearbox, cstrike, czero, czeror, dod and several mods) with the smoke runner's directory argument, which now also scans
.bsp.!Src.bspfiles whose surface extents exceed 512; the engine'sCalcSurfaceExtentsrefuses those too.c2a2a,de_inferno_cz,dod_jagd);cz_worldmap,sphere256.bsp);Tests
tests/BSPTests.hbuilds a complete one-face world lump by lump. It checks it through the real DLL, then breaks each rule one field at a time, for both layouts.Verification
scripts/build-UtilAssetsIntegrity-x86-Release.batandscripts/build-UtilAssetsIntegrity-x86-Debug.batboth exit 0. CTest passes 1/1 and the installed-DLL smoke test passes in each configuration.format-check: 8 files, 0 with differences.🤖 Generated with Claude Code