MiniDoom

src/m_misc.ml

Handles configuration defaults, screenshots, file buffers, and Doom patch-backed utility output.

Package
(global)
Reachable
Yes

Imports

Declarations

_M_ApplyDefaultKV

function _M_ApplyDefaultKV(key, val)

Parses one configuration key/value pair and assigns the converted value to the matching registered default.

ParameterTypeDefaultDescription
keydynamic—Input key code to process.
valdynamic—Val value supplied to `_M_ApplyDefaultKV`.

View source

_M_GetDefaultFilePath

function _M_GetDefaultFilePath()

Chooses the configuration path from -config, the -cdrom legacy location, an existing base override, or default.cfg.

View source

_M_IsSpaceByte

inline function _M_IsSpaceByte(c)

Recognizes the space and horizontal-tab delimiters accepted in configuration lines.

ParameterTypeDefaultDescription
cdynamic—C value supplied to `_M_IsSpaceByte`.

View source

_M_MakeShotName

inline function _M_MakeShotName(i)

Formats a two-digit screenshot slot as the classic DOOMnn.pcx filename.

ParameterTypeDefaultDescription
idynamic—Zero-based iteration index.

View source

_M_ParentDirExists

function _M_ParentDirExists(path)

Determines whether a target path can be written by verifying that its parent directory exists.

ParameterTypeDefaultDescription
pathdynamic—Filesystem path to process.

View source

_M_ParseDefaultLine

function _M_ParseDefaultLine(line)

Parses parse Default Line input into utility runtime data.

ParameterTypeDefaultDescription
linedynamic—Map line or text line affected by the operation.

View source

_M_ParseInt

function _M_ParseInt(s0)

Parses parse Int input into utility runtime data.

ParameterTypeDefaultDescription
s0dynamic—S0 value supplied to `_M_ParseInt`.

View source

_M_ParseText

inline function _M_ParseText(s0)

Parses optional quoted text value from config lines.

ParameterTypeDefaultDescription
s0dynamic—S0 value supplied to `_M_ParseText`.

View source

_M_patchWidth

inline function _M_patchWidth(patch)

Reads a Doom patch's little-endian width field, returning zero for malformed data.

ParameterTypeDefaultDescription
patchdynamic—Patch value supplied to `_M_patchWidth`.

View source

_M_QuoteText

function _M_QuoteText(s0)

Wraps text in quotes for config persistence.

ParameterTypeDefaultDescription
s0dynamic—S0 value supplied to `_M_QuoteText`.

View source

_M_Trim

function _M_Trim(s0)

Removes leading and trailing configuration whitespace without altering embedded spaces.

ParameterTypeDefaultDescription
s0dynamic—S0 value supplied to `_M_Trim`.

View source

_M_u16le

inline function _M_u16le(b, off)

Decodes one unsigned little-endian 16-bit value from a byte buffer with bounds checks.

ParameterTypeDefaultDescription
bdynamic—Second input operand.
offdynamic—Zero-based byte or element offset.

View source

_M_UpperAscii

inline function _M_UpperAscii(c)

Folds one lowercase ASCII byte to uppercase while leaving all other bytes unchanged.

ParameterTypeDefaultDescription
cdynamic—C value supplied to `_M_UpperAscii`.

View source

_M_WritePCXfile

function _M_WritePCXfile(filename, data, width, height, palette)

Validates indexed pixels and palette, RLE-encodes a complete 8-bit PCX image, and saves it to disk.

ParameterTypeDefaultDescription
filenamedynamic—Filesystem name of the target resource.
datadynamic—Binary or structured data to process.
widthdynamic—Width of the target in pixels or map units.
heightdynamic—Height of the target in pixels or map units.
palettedynamic—Palette value supplied to `_M_WritePCXfile`.

View source

_M_WriteU16LE

inline function _M_WriteU16LE(buf, off, value)

Encodes the low 16 bits of a value at a byte-buffer offset in little-endian order.

ParameterTypeDefaultDescription
bufdynamic—Buf value supplied to `_M_WriteU16LE`.
offdynamic—Zero-based byte or element offset.
valuedynamic—Value consumed by the operation.

View source

_MMISC_IDiv

inline function _MMISC_IDiv(a, b)

Returns a signed quotient truncated toward zero, or zero for invalid operands and a zero divisor in `_MMISC_IDiv`

ParameterTypeDefaultDescription
adynamic—First input operand.
bdynamic—Second input operand.

View source

default_t struct

defaultfile

defaultfile

Holds the optional defaultfile resource used by the m misc subsystem.

View source

defaults

defaults

Stores the defaults collection used by the m misc subsystem.

View source

M_DrawText

function M_DrawText(x, y, direct, string)

Draws an uppercase patch-font string at logical screen coordinates and returns the x position after the final glyph.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
directdynamic—Direct value supplied to `M_DrawText`.
stringdynamic—String value supplied to `M_DrawText`.

View source

M_LoadDefaults

function M_LoadDefaults()

Restores built-in settings, parses recognized configuration keys, applies CLI multiplayer overrides, and clamps the result.

View source

M_ReadFile

function M_ReadFile(name, bufferOut)

Loads an entire file into an output reference, returning its byte count and routing failures through I_Error.

ParameterTypeDefaultDescription
namedynamic—Resource or object name to resolve.
bufferOutdynamic—Buffer out value supplied to `M_ReadFile`.

View source

M_SaveDefaults

function M_SaveDefaults()

Serializes current input, audio, message, and multiplayer settings to the selected configuration file.

View source

M_ScreenShot

function M_ScreenShot()

Chooses the next unused DOOMxx screenshot name and writes the current framebuffer as a PCX image.

View source

M_WriteFile

function M_WriteFile(name, source, length)

Persists exactly the requested byte prefix and returns false when validation or filesystem output fails.

ParameterTypeDefaultDescription
namedynamic—Resource or object name to resolve.
sourcedynamic—Source value or buffer.
lengthdynamic—Number of bytes or elements in the associated value.

View source

numdefaults

numdefaults

Tracks the mutable numdefaults value used by the m misc subsystem.

View source

usejoystick

usejoystick

Tracks the mutable usejoystick value used by the m misc subsystem.

View source

usemouse

usemouse

Tracks the mutable usemouse value used by the m misc subsystem.

View source

WritePCXfile

function WritePCXfile(filename, data, width, height, palette)

Exposes the validated 8-bit PCX encoder through Doom's public screenshot-writing entry point.

ParameterTypeDefaultDescription
filenamedynamic—Filesystem name of the target resource.
datadynamic—Binary or structured data to process.
widthdynamic—Width of the target in pixels or map units.
heightdynamic—Height of the target in pixels or map units.
palettedynamic—Palette value supplied to `WritePCXfile`.

View source