GoldSrc mount: register source files as ResourceType.Binary - #11686
Open
ecclesialatina01 wants to merge 3 commits into
Open
GoldSrc mount: register source files as ResourceType.Binary#11686ecclesialatina01 wants to merge 3 commits into
ecclesialatina01 wants to merge 3 commits into
Conversation
Registers every scanned file as Binary alongside the existing conversions, excluding the player's own files (configs, saves, demos, logs, sprays). skill.cfg is re-allowed by name since it's retail game data. Adds a BinaryResource case to the mounting integration tests covering path preservation and byte round-trip.
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
A mounted GoldSrc game currently exposes only what the mount converts: WAD textures and materials, MDL models, WAV sounds. There's no way to get at the source files.
This registers every scanned file as the engine's unused
ResourceType.Binary, so a game can read the raw bytes. Player files (configs, saves, demos, logs, sprays) are excluded.This isn't a map loader, and a map loader doesn't replace it, because loading a map and exposing its bytes are separate registrations. The Quake mount has a full map loader and registers no raw files. The same registration would fit there too, since Quake keeps its entities in the same BSP lump and its game logic in
progs.dat, which has no converted form either.Motivation & Context
The converted resources don't keep everything the source files contain. A BSP's entity lump, where Half-Life keeps its monsters, scripted sequences and target wiring, has no converted form at all, because the scan only handles
.wad,.mdland.wav. An MDL's attachments and events don't survive model conversion; the parser reads them but the model builder never uses them. Sprites, skyboxes, HUD sprite manifests,sentences.txt,skill.cfgand the soundtrack aren't registered at all.Reading them directly is a whitelist no-no, so the mount is the only route to a mounted game's bytes.
I'm using this in a Half-Life recreation where the entity lump is used for the map's monsters and triggers,
skill.cfgfor damage tables,sentences.txtfor scripted speech, and the skies and HUD come fromgfx/env/andsprites/*.txt. With this addition the whole game runs off the mount.Implementation Details
Uses the existing
MountContext.AddwithResourceType.Binary. Paths don't clash because the engine appends an extension to converted resources, so a converted model registers asmodels/x.mdl.vmdlwhile the raw file staysmodels/x.mdl.lazy loading:
File.ReadAllBytesruns only when someone actually asks for the resource, through the sameResourceLoadercaching every other mount type uses.Checklist