Files
src/w_wad.ml
Implements WAD/lump lookup, caching, and resource loading helpers.
- Package
(global)- Reachable
- Yes
Imports
Declarations
# _W_AddCachedDataName
function _W_AddCachedDataName(data, name)
Appends one data/name pair to the cached lump name lookup without using concatenation.
| Parameter | Type | Default | Description |
|---|
data | dynamic | — | Binary or structured data to process. |
name | dynamic | — | Resource or object name to resolve. |
View source
# _W_AddFilesFromArgv
function _W_AddFilesFromArgv()
Adds files from argument entries to the WAD resource.
View source
# _W_AddLoadedFile
inline function _W_AddLoadedFile(path, data)
Appends an in-memory WAD file record and returns the stable index stored by its lump directory entries.
| Parameter | Type | Default | Description |
|---|
path | dynamic | — | Filesystem path to process. |
data | dynamic | — | Binary or structured data to process. |
View source
# _W_CACHE_NULL_PTR
const _W_CACHE_NULL_PTR = -1
Defines w cache null ptr for the w wad subsystem.
View source
# _W_CopyBytes
inline function _W_CopyBytes(b, off, n)
Returns an independent byte slice for a requested WAD-file range.
| Parameter | Type | Default | Description |
|---|
b | dynamic | — | Second input operand. |
off | dynamic | — | Zero-based byte or element offset. |
n | dynamic | — | Number of values to process. |
View source
# _W_files
_W_files
Stores the w files collection used by the w wad subsystem.
View source
# _W_IntToString
function _W_IntToString(v)
Formats integer values for WAD diagnostics without implicit stringification.
| Parameter | Type | Default | Description |
|---|
v | dynamic | — | Value consumed by the operation. |
View source
# _W_IsHDWADData
inline function _W_IsHDWADData(data)
Validates the minimum header length and four-byte MDHD signature of an in-memory HDWAD package.
| Parameter | Type | Default | Description |
|---|
data | dynamic | — | Binary or structured data to process. |
View source
# _W_IsWadFilename
inline function _W_IsWadFilename(path)
Recognizes a case-insensitive .wad suffix without allocating a normalized path copy.
| Parameter | Type | Default | Description |
|---|
path | dynamic | — | Filesystem path to process. |
View source
# _W_Name8Equals
inline function _W_Name8Equals(a, b)
Compares two canonical eight-byte lump names without string allocation.
| Parameter | Type | Default | Description |
|---|
a | dynamic | — | First input operand. |
b | dynamic | — | Second input operand. |
View source
# _W_Name8FromString
inline function _W_Name8FromString(name)
Uppercases, truncates, and zero-pads a string to Doom's fixed eight-byte lump-name representation.
| Parameter | Type | Default | Description |
|---|
name | dynamic | — | Resource or object name to resolve. |
View source
# _W_Name8ToString
function _W_Name8ToString(name)
Converts an internal eight-byte lump name to a safe display string.
| Parameter | Type | Default | Description |
|---|
name | dynamic | — | Resource or object name to resolve. |
View source
# _W_profile_count
_W_profile_count
Tracks the mutable w profile count value used by the w wad subsystem.
View source
# _W_profile_info
_W_profile_info
Stores the w profile info collection used by the w wad subsystem.
View source
# _W_ReadI32LE
inline function _W_ReadI32LE(b, off)
Decodes one signed 32-bit little-endian field from a WAD header or directory entry.
| Parameter | Type | Default | Description |
|---|
b | dynamic | — | Second input operand. |
off | dynamic | — | Zero-based byte or element offset. |
View source
# _W_RememberCachedDataName
function _W_RememberCachedDataName(data, name)
Associates cached lump bytes with a known name without touching lumpinfo metadata.
| Parameter | Type | Default | Description |
|---|
data | dynamic | — | Binary or structured data to process. |
name | dynamic | — | Resource or object name to resolve. |
View source
# _W_SlotEmpty
inline function _W_SlotEmpty(slot)
Tests the cache-slot convention in which empty, void, or negative pointer values mean no resident lump.
| Parameter | Type | Default | Description |
|---|
slot | dynamic | — | Slot value supplied to `_W_SlotEmpty`. |
View source
# _W_ToIntOr
function _W_ToIntOr(v, fallback)
Converts int or values for the WAD resource.
| Parameter | Type | Default | Description |
|---|
v | dynamic | — | Value consumed by the operation. |
fallback | dynamic | — | Value returned when the requested conversion or lookup is unavailable. |
View source
# _W_ToPathString
inline function _W_ToPathString(v)
Converts path string values for the WAD resource.
| Parameter | Type | Default | Description |
|---|
v | dynamic | — | Value consumed by the operation. |
View source
# _W_ToUpperAscii
inline function _W_ToUpperAscii(s)
Uppercases ASCII lump-name characters in a newly allocated string while preserving nonletters.
| Parameter | Type | Default | Description |
|---|
s | dynamic | — | S value supplied to `_W_ToUpperAscii`. |
View source
# filelength
inline function filelength(handle)
Returns the byte length of a validated loaded-file handle.
| Parameter | Type | Default | Description |
|---|
handle | dynamic | — | Handle value supplied to `filelength`. |
View source
filelump_t struct
# lumpcache
lumpcache
Holds the optional lumpcache resource used by the w wad subsystem.
View source
# lumpinfo
lumpinfo
Holds the optional lumpinfo resource used by the w wad subsystem.
View source
lumpinfo_t struct
# numlumps
numlumps
Tracks the mutable numlumps value used by the w wad subsystem.
View source
# reloadfile
reloadfile
Tracks the mutable reloadfile value used by the w wad subsystem.
View source
# reloadlump
reloadlump
Tracks the mutable reloadlump value used by the w wad subsystem.
View source
# reloadname
reloadname
Holds the optional reloadname resource used by the w wad subsystem.
View source
# strupr
inline function strupr(s)
Exposes allocation-safe ASCII uppercase conversion under the legacy WAD API name.
| Parameter | Type | Default | Description |
|---|
s | dynamic | — | S value supplied to `strupr`. |
View source
# W_AddFile
function W_AddFile(filename)
Loads a WAD or single-lump file, validates its directory, and appends normalized entries in load-order override precedence.
| Parameter | Type | Default | Description |
|---|
filename | dynamic | — | Filesystem name of the target resource. |
View source
# W_CacheLumpName
function W_CacheLumpName(name, tag)
Resolves a canonical lump name, ensures its data is resident under the requested tag, and preserves name metadata for patch users.
| Parameter | Type | Default | Description |
|---|
name | dynamic | — | Resource or object name to resolve. |
tag | dynamic | — | Zone-memory or resource-lifetime tag. |
View source
# W_CacheLumpNum
function W_CacheLumpNum(lump, tag)
Allocates and fills a lump's zone-cache slot on first use, retags resident data, and records patch-name identity.
| Parameter | Type | Default | Description |
|---|
lump | dynamic | — | Lump value supplied to `W_CacheLumpNum`. |
tag | dynamic | — | Zone-memory or resource-lifetime tag. |
View source
# W_CheckNumForName
function W_CheckNumForName(name)
Searches the merged directory backward so later WADs override earlier lumps with the same canonical name.
| Parameter | Type | Default | Description |
|---|
name | dynamic | — | Resource or object name to resolve. |
View source
# W_GetCachedLumpPtr
function W_GetCachedLumpPtr(lump)
Returns a resident lump's zone pointer without loading it, or the null-pointer sentinel for invalid or empty slots.
| Parameter | Type | Default | Description |
|---|
lump | dynamic | — | Lump value supplied to `W_GetCachedLumpPtr`. |
View source
# W_GetNumForName
function W_GetNumForName(name)
Resolves a lump name to its overriding directory index and raises a fatal error when absent.
| Parameter | Type | Default | Description |
|---|
name | dynamic | — | Resource or object name to resolve. |
View source
# W_HDWAD_MAX_VERSION
const W_HDWAD_MAX_VERSION = 6
Defines the maximum w hdwad max version accepted by the w wad subsystem.
View source
# W_HDWAD_MIN_VERSION
const W_HDWAD_MIN_VERSION = 1
Defines the minimum w hdwad min version accepted by the w wad subsystem.
View source
# W_InitFile
function W_InitFile(filename)
Initializes the merged lump directory and cache from a single WAD path.
| Parameter | Type | Default | Description |
|---|
filename | dynamic | — | Filesystem name of the target resource. |
View source
# W_InitMultipleFiles
function W_InitMultipleFiles(filenames)
Clears prior resource state, loads each configured WAD in order, validates the result, and creates empty zone-cache slots.
| Parameter | Type | Default | Description |
|---|
filenames | dynamic | — | Filenames value supplied to `W_InitMultipleFiles`. |
View source
# W_LumpLength
function W_LumpLength(lump)
Validates a lump index and returns its directory byte size.
| Parameter | Type | Default | Description |
|---|
lump | dynamic | — | Lump value supplied to `W_LumpLength`. |
View source
# W_NameForCachedData
function W_NameForCachedData(data)
Returns the WAD lump name for a cached byte view, when known.
| Parameter | Type | Default | Description |
|---|
data | dynamic | — | Binary or structured data to process. |
View source
# W_NumLumps
function W_NumLumps()
Returns the current merged directory size after all WAD and single-lump files have been added.
View source
# W_Profile
function W_Profile()
Samples cache residency for every lump and accumulates a per-snapshot history used to inspect resource-cache behavior.
View source
# W_ReadLump
function W_ReadLump(lump, dest)
Copies one validated lump byte range from its owning loaded file into the caller's destination buffer.
| Parameter | Type | Default | Description |
|---|
lump | dynamic | — | Lump value supplied to `W_ReadLump`. |
dest | dynamic | — | Dest value supplied to `W_ReadLump`. |
View source
# W_Reload
function W_Reload()
Re-reads the designated reloadable WAD, invalidates its resident cache entries, and updates directory positions and sizes in place.
View source
# wad_cached_patch_bytes
wad_cached_patch_bytes
Stores the wad cached patch bytes collection used by the w wad subsystem.
View source
# wad_cached_patch_last_data
wad_cached_patch_last_data
Holds the optional wad cached patch last data resource used by the w wad subsystem.
View source
# wad_cached_patch_last_name
wad_cached_patch_last_name
Stores the mutable wad cached patch last name text used by the w wad subsystem.
View source
# wad_cached_patch_names
wad_cached_patch_names
Stores the wad cached patch names collection used by the w wad subsystem.
View source
wadfile_t struct
wadinfo_t struct