Detecting and handling anti-decompiling protection methods
BSPSource can detect various anti-decompilation protection methods used by mappers to prevent reverse engineering of their maps. Understanding these methods helps you know what to expect from decompiled output.
Detection: Presence of tools/locked texture in texture listPurpose: Signals that the map is protected against decompilationImpact: Low - BSPSource ignores this flagDetection in code:
if (bspprot.hasTextureFlag()) { // "VMEX texture flag (tools/locked)" detected}
Detection: >90% of brush sides use nodraw texture (texinfo = 0)Purpose: Corrupts texinfo optimization to break texture reconstructionImpact:High - Most textures will be incorrect or missingDetection in code:
if (bspprot.hasModifiedTexinfo()) { // "IID nodraw texture hack" detected}
Maps using the nodraw hack will have severely broken textures. Tool texture fixing cannot recover the original texture names.
Protector brushes are detected using these checks:
private static final float EPS_SIZE = 0.01f;private static final float ALIGNED_ALPHA = 0.99f;private static final Vector3d PB1 = new Vector3d(1, 4, 9);private static final Vector3d PB2 = new Vector3d(4, 9, 1);private static final Vector3d PB3 = new Vector3d(9, 1, 4);// Brush must be:// 1. Axis-aligned (one normal component > 0.99)// 2. All sides same texture// 3. Exact dimensions matching PB1, PB2, or PB3
These are informational markers. Decompilation will work normally. Protected elements are marked in visgroups for reference.
BSPProtect encryption detected
Entity data is unrecoverable. You can still extract brush geometry and worldspawn, but all other entities will be missing or incomplete.
Nodraw hack detected
Textures are severely corrupted. You can reconstruct geometry but will need to manually re-texture most surfaces. Use faceTexture override for debugging.
Entity obfuscation detected
Entities will decompile but targetnames are meaningless numbers. You’ll need to manually reconstruct logical entity relationships.
BSPSource intentionally ignores VMEX-style flags (entity, texture, brush) as these are informational rather than technical protections.What can be bypassed:
VMEX flags (automatically ignored)
Protector brushes (flagged but decompiled)
What cannot be bypassed:
BSPProtect encryption (requires decryption key)
Nodraw hack (texture data is corrupted)
Entity obfuscation (targetnames are lost)
Attempting to decompile protected maps may violate the mapper’s wishes or terms of use. Always respect intellectual property rights.