Configuration file (lba2.cfg)

May 10, 2026 · View on GitHub

lba2.cfg stores user preferences and last-save info. Read at startup, written at exit. Options changed in the menu (see MENU.md) are persisted here. This doc distinguishes original keys from community additions so future changes can be tracked.

Path and discovery

  • Filename: lba2.cfg (SOURCES/COMMON.H line 83: CFG_NAME)
  • User config path: GetCfgPath(PathConfigFile, ..., CFG_NAME)directoriesCfgDir + filename (SOURCES/DIRECTORIES.CPP)
  • Default (assets): GetDefaultCfgPath()directoriesResDir + filename (same folder as lba2.hqr, i.e. the game assets directory)
  • If user config missing: copy from assets to config dir (SOURCES/INITADEL.C). If the assets folder has no lba2.cfg, the engine writes an embedded copy (generated at build time from SOURCES/LBA2.CFG via cmake/embed_lba2_cfg.cmake) into the user config path instead of exiting.
  • Default config source: Prefer the file in the asset directory (directoriesResDir). The repo has SOURCES/LBA2.CFG and SOURCES/CONFIG/LBA2.CFG as reference/templates. See GAME_DATA.md for where assets live.

File format

  • DefFile format: Key: value or Key= value, ; comments (LIB386/SYSTEM/DEFFILE.CPP)
  • API: DefFileBufferInit(file, buffer, size), DefFileBufferReadString/ReadValue/ReadValueDefault, DefFileBufferWriteString/WriteValue

Lifecycle

  • Read: ReadConfigFile() in SOURCES/PERSO.CPP (line 1701), invoked from InitProgram() at line 1825
  • Write: WriteConfigFile() in PERSO.CPP (line 1757), called from TheEndInfo() (line 1955)
  • Options menu changes globals only; config is written once at exit. No intermediate saves when changing options.

Keys: what each does

Accepted values

KeyTypeAccepted valuesDefaultClamping / notes
LastSavestringPlayer name, max 100 chars(empty)Used for quick load
Shadowint1–33Overwritten by DetailLevel when leaving Options. 1=none on extras, 2=no impact shadows, 3=full
AllCamerasint0, 110=OFF, 1=ON
FollowCameraint0, 10Auto camera (user-facing name; Enhanced Edition–style third-person follow in exterior). Config key stays FollowCamera for stability. 0=classic (default), 1=auto. Also reads legacy key AutoCameraCenter
ReverseStereoint0, 100=OFF, 1=ON
DetailLevelint0–330=min (no rain, no sea, no horizon), 1=486, 2=base Pentium, 3=max. Drives Shadow, RainEnable, MaxPolySea, FlagDrawHorizon
FullScreenint0, 110=small videos, 1=fullscreen videos. Invalid values → 1
DisplayFullScreenint0, 110=windowed display, 1=fullscreen display. Invalid values → 0
FlagDisplayTextstringON, OFFONCase-insensitive. Any other value → ON
WaveVolumeint0–12797Sample/SFX volume
VoiceVolumeint0–127112Voice volume
MusicVolumeint0–127127Music/jingle volume (stored as JingleVolume in code)
CDVolumeint0–12766CD audio volume (no-op when no CD); still supported in config but no longer shown in the in-game volume submenu
MasterVolumeint0–127127Master volume, scales samples and music
Input0_1..Input35_2intKey scancodesDefKeysDefault9536 inputs × 2 keys each (MAX_INPUT in INPUT.H). Only read when WinMode=1
WinModeint0, 100=ignore Input* keys, use defaults; 1=read Input* keys. WriteInputConfig always writes WinMode=1
CompressSaveint0, 110=uncompressed saves, 1=compressed
Version, Version_USintDistributor ID0 (UNKNOWN_VERSION)Activision, EA, Virgin, regional variants. Set via distrib console command.
LanguagestringEnglish, Français, Deutsch, Español, Italiano, PortuguesEnglishMust match TabLanguage[] exactly (case-insensitive)
LanguageCDstringSame as LanguageEnglishVoice CD language; only used with CDROM build
FlagKeepVoicestringON, OFFONKeep voice files on HD
MenuMouseint0, 111 = menu cursor, hover/left-click confirm, wheel for sliders and save list; 0 = keyboard/joystick only (classic)

Original keys (Adeline)

KeyPurposeSourceMenu
LastSavePlayer name for quick loadReadConfigFile / WriteConfigFile(implicit)
ShadowShadow quality (1–3)ReadConfigFile / WriteConfigFileOptions → Detail
AllCamerasScenario cameras ON/OFFReadConfigFile / WriteConfigFileOptions
ReverseStereoStereo invertReadConfigFile / WriteConfigFileOptions
DetailLevelGraphics detail (0–3)ReadConfigFile / WriteConfigFileOptions
FullScreenVideo playback sizeReadConfigFile / WriteConfigFileOptions → Advanced options
DisplayFullScreenWindow/display fullscreen toggleReadConfigFile / WriteConfigFileOptions → Advanced options
FlagDisplayTextShow subtitles during voiceReadConfigFile / WriteConfigFileOptions → Advanced options
WaveVolume, VoiceVolume, MusicVolume, MasterVolumeVolume slidersReadVolumeSettings / WriteVolumeSettingsOptions → Sound volume
CDVolumeCD audio volumeReadVolumeSettings / WriteVolumeSettingsconfig only
Input0_1..Input35_2, WinModeKeyboard mappingsReadInputConfig / WriteInputConfigOptions → Keyboard
CompressSaveSave compression formatReadConfigFile(installer)
Version, Version_USDistributor versionReadConfigFile / distrib console(installer; distrib console)
Language, LanguageCD, FlagKeepVoiceLanguage / voice CDMESSAGE.CPP, ReadConfigFile / WriteConfigFileOptions → Choose language

Note: FlagKeepVoice remains installer / CONFIG-tool managed. Language and LanguageCD are now also written by the in-game Options menu.

Community / modernized additions

KeyPurposeSourceMenu
MenuMouseOptional mouse UX in game menus (FlagMenuMouse in code). Default 1 (on). Set 0 to match classic keyboard/joystick-only menus. See MENU.mdReadConfigFile / WriteConfigFileOptions → Advanced options
FollowCameraAuto camera for exterior scenes (0=classic, 1=auto). Community addition, not in original game; menu label is "Auto camera" / "Classic camera"ReadConfigFile / WriteConfigFileOptions → Advanced options

Code reference

ConceptFileFunction/Symbol
Config read/writePERSO.CPPReadConfigFile, WriteConfigFile
Volume persistenceAMBIANCE.CPPReadVolumeSettings, WriteVolumeSettings
Input persistenceINPUT.CPPReadInputConfig, WriteInputConfig
Config pathDIRECTORIES.CPPGetCfgPath, GetDefaultCfgPath
DefFile APILIB386/SYSTEM/DEFFILE.CPPDefFileBufferInit, DefFileBufferRead*, DefFileBufferWrite*

Cross-references