read_fixed_c_string

Function read_fixed_c_string 

Source
pub fn read_fixed_c_string(
    bytes: &[u8],
    offset: usize,
    max_len: usize,
) -> String
Expand description

Reads a null-terminated string from a fixed-size field in a byte buffer.

Scans up to max_len bytes starting at offset for the first null byte, then decodes the preceding bytes as Windows-1252 (the engine’s native codepage). If no null byte is found, the entire max_len slice is decoded.

This is the standard binary format string primitive used across KotOR formats (model names, texture names, resource labels, etc.).