xScal Scaleform API 0.4.34

xScal Scaleform API

Version 0.4.34

Functions xScal installs on the Scaleform code object, __SFCodeObj, in Fallout 76 menus. SWF mods call them from ActionScript 3.

The SWF creates the object, usually as this.stage.__SFCodeObj = {}. When the SWF first uses it, xScal installs three members on it:

MemberUse
call(name, ...args)Calls one of the functions below by name and returns its result.
versionObject with the runtime name, version and platform.
modStoragePer-mod JSON storage: save, load, register.

Results described as String (JSON) are Strings; parse them with JSON.parse before use. The field tables list the parsed object.

Wrap xScal access in try/catch so the mod keeps working when xScal is missing or the game build is not supported:

try {
    var result:* = __SFCodeObj.call("someFunctionName");
} catch (error:Error) {
    // xScal is missing or the function is not available.
}

Reference

Version

Runtime name, version and platform.

versionRuntime name, version and platform
GetXSRuntimeInfoRuntime information as JSON
GetZFERuntimeInfoAlias of GetXSRuntimeInfo

Mod storage

One JSON document per name in Data/modsdata/<name>.json, through __SFCodeObj.modStorage.

modStorage.saveSave a named JSON document
modStorage.loadLoad a named JSON document
modStorage.registerBind the movie to one storage name (legacy)

Input: keyboard

Windows virtual-key codes 1 to 255. A key must be registered before Input.IsKeyPressed reports it; unregistered keys return false. Polling a few keys once per frame is cheap.

Input.RegisterKeyRegister a virtual key for polling
Input.IsKeyPressedIs a registered key held
Input.UnregisterKeyUnregister one key
Input.ClearKeysUnregister every key
Input.SuppressKeyHide a key from Fallout 76
Input.UnsuppressKeyStop hiding one key
Input.ClearKeySuppressionsStop hiding every key

Input: gamepad

XInput digital button masks (1 to 65535) and an optional controller index (0 to 3, default 0). Combine buttons with bitwise OR. Extra held buttons do not stop a registered chord from matching.

Input.RegisterGamepadButtonsRegister a button mask for polling
Input.AreGamepadButtonsPressedAre all buttons of a registered mask held
Input.UnregisterGamepadButtonsUnregister one mask for one controller
Input.ClearGamepadButtonsUnregister every mask on all four controllers
Input.PollGamepadRead buttons, triggers and sticks of one controller
Input.SuppressGamepadButtonsHide buttons from Fallout 76
Input.UnsuppressGamepadButtonsStop hiding buttons
Input.SuppressGamepadAnalogZero triggers and sticks for Fallout 76
Input.UnsuppressGamepadAnalogPass triggers and sticks to Fallout 76 again
Input.ClearGamepadSuppressionsEnd every button and analog suppression

Input: mouse

Mouse capture. While captured, raw-input mouse records are added to the totals Input.PollMouse returns and are not passed to Fallout 76.

Input.BeginMouseCaptureStart capturing mouse input
Input.PollMouseRead and reset mouse totals
Input.EndMouseCaptureStop capturing mouse input

Input: text

One owned text-input session at a time. While a session exists, xScal consumes keyboard key, character and raw-input messages before Fallout 76 gets them; mouse raw input still reaches the game. The native buffer holds at most 512 UTF-16 code units. A key still held when the session ends stays consumed until its key-up message.

Input.BeginInputStart the owned text-input session
Input.PollInputRead the session's text, cursor and state
Input.EndInputClose the session

Providers

Live HUD and Pip-Boy data as JSON strings, under the xsGet* names. These calls take no arguments.

xsGetEnemyMeterDataTarget shown by the HUD enemy meter
xsGetStealthMeterDataStealth meter state
xsGetPipboySTATSEffectsVisible Pip-Boy status effects
xsGetTimeDataIn-game clock
xsGetPlayerMapPositionPlayer position on the Pip-Boy map

Game

Player data read from the game's own structures, as JSON strings. These calls take no arguments and work while the Pip-Boy is closed.

Game.ClockAlias of xsGetTimeData
Game.GetAS3ObjectResult of a Game.* call as an ActionScript object
Game.GetSpecialCurrent SPECIAL values (Steam only)
Game.GetStatusPlayer vitals from the Pip-Boy header and STAT page
Game.GetPlayerInfoName, level and XP
Game.GetPerksPerk cards
Game.GetQuestsQuest objectives the Pip-Boy lists
Game.GetInventoryCarried items
Game.GetCollectionsCollectibles the STAT page lists

Engine graphics

Published by the Fallout76 NX plugin (Fallout76_DLSSFrameGen.dll) through xScal's plugin callback ABI. If the plugin is missing or rejected, these names do not exist. Setters return false when the feature cannot be enabled in the active renderer session.

Engine.EnableDLSSFrameGenEnable DLSS frame generation
Engine.DisableDLSSFrameGenDisable DLSS frame generation
Engine.EnableFSRFrameGenEnable FSR frame generation
Engine.DisableFSRFrameGenDisable FSR frame generation
Engine.EnableReflexSave Reflex On
Engine.DisableReflexSave Reflex Off
Engine.AvailableUpscalersProviders the active renderer supports
Engine.GetUpscalerStateRequested frame-generation backend and applied Reflex mode
Engine.SetFramegenProviderSave the frame-generation backend for the next session

Plugin options

Options that loaded xScal plugins publish, for in-game settings menus.

xsGetPluginOptionsOptions of every active plugin
xsSetPluginOptionChange one plugin option

SFE legacy

Old callback names kept so existing mods work without changes.

logFCM diagnostic log
writeBuffDataFileReplace Data\BuffData.ini
writeChallengeDataFileReplace Data\ChallengeData.ini
writePerksFileReplace Data\perkloadoutmanager.ini
writeSaveEverythingFileReplace Data\saveeverything.ini
writeItemsModFileReplace Data\itemsmod.ini
writeLegendaryModsFileReplace Data\LegendaryMods.ini
writeVendorLogFileAppend to Data\vendorlog.txt
writeDPSMeterFileReplace Data\DPSMeter.txt
writeCampSearchConfigFileReplace Data\CAMPSearch.ini
writeBlockFileReplace Data\configuration\blocklist.ini
writeCampDataFileReplace Data\CampData.ini
writeCharacterDataFileReplace Data\CharacterData.ini