Standard library ​

When your engine plugin initializes, it receives a const SwoftyApi *. Through that pointer, you can use the mixin system, settings and logging, plus nested tables for events, overlay, telemetry, database reads and storage. These make up the standard library. Each library has one C++ wrapper header and one reference page.

Libraries ​

LibraryHeaderFeatureAPIThread
Mixin systemswofty/mixin.hpphook2Game thread
Settingsswofty/mixin.hppoptions3Flow thread
Loggingswofty/mixin.hpplog1Any
Eventsswofty/events.hppevents (stable)5Flow thread
Overlayswofty/overlay.hppoverlay (experimental)5Render thread
Telemetryswofty/telemetry.hpptelemetry (experimental)5Flow thread
Database readswofty/db.hppdb (stable)5Caller thread
Storageswofty/storage.hppstorage (stable)5Caller thread
Careerswofty/career.hppcareer (stable)6, block 7Flow thread
Popupswofty/popup.hpppopup (stable)7Any; shown on the flow thread
Stringsswofty/lang.hpplang (stable)8Any; refresh on the game thread
Career contentsswofty/career_content.hppcareer (experimental)8, feature-detectedAddon init, flow thread
Charactersswofty/characters.hppcareer (stable)8, feature-detectedAny; refresh on the game thread
Career wizardswofty/career_wizard.hppcareer (stable)8, feature-detectedAny
Era picker boxesswofty/era.hppnone8, feature-detectedAddon init; others any
Memoryswofty/mem.hppnone (header only)anyAny

For screens and home tiles, use an addon operation rather than a SwoftyApi table; see UI. You can find the merged engine-side contract for the version-5 tables in the native-libraries design.

Headers ​

Include the header for the library you need. The addon template ships these headers under native/include/.

HeaderLocationContents
swofty_api.hpackages/sdk/include/The C ABI: SwoftyApi, mixin records, setting values, the nested tables. MIT
swofty/mixin.hpppackages/sdk/include/swofty/The C++ layer: mixin macros, bindings, settings, swofty::log, SWOFTY_ADDON
swofty/events.hpppackages/sdk/include/swofty/Lifecycle events and the frame tick
swofty/overlay.hpppackages/sdk/include/swofty/The 2D overlay
swofty/telemetry.hpppackages/sdk/include/swofty/Live car and session reads
swofty/db.hpppackages/sdk/include/swofty/Game-database reads
swofty/storage.hpppackages/sdk/include/swofty/Addon storage
swofty/career.hpppackages/sdk/include/swofty/Flow states, the running career, its components, the game bus and career-mode blocks
swofty/popup.hpppackages/sdk/include/swofty/The game's message popup with your text
swofty/career_content.hpppackages/sdk/include/swofty/Extra career content tiles with their own save slots, and the per-career check
swofty/characters.hpppackages/sdk/include/swofty/Per-career character refs, voices and strings
swofty/career_wizard.hpppackages/sdk/include/swofty/Per-career new-career wizard control
swofty/era.hpppackages/sdk/include/swofty/Boxes in the Addons row of the Grand Prix / Time Trial era picker
swofty/mem.hpppackages/sdk/include/swofty/Guarded memory reads: read, in_image, object_like, c_string
swofty/assets.hpppackages/sdk/include/swofty/Runtime asset loading; see Asset API
swofty/game.hpp, swofty/game/*.hppnative/include/swofty/The Game API: the engine's functions, structs and sites

If you're writing Rust, the swofty-sdk crate (packages/sdk) mirrors the C ABI.

Result codes ​

The version-5, version-6 and version-7 tables (events, overlay, telemetry, db, storage, career, popup) share the same result codes, so you can interpret their results the same way. Each wrapper exposes a Result enum; use name(r) to turn it into a string:

ResultSWOFTY_ASSET_*Meaning
okOK (0)The call succeeded
lateLATE (1)Too late to apply, or a cursor is exhausted
unavailableUNAVAILABLE (2)The loader is older than the table's version, the feature is off, or the lane is not implemented
invalidINVALID (3)A bad argument

Guard every call with available(). A table's available() returns non-zero only when its feature is on and the core implements it. If the loader offers a version below the table's (5, 6 for career, 7 for career::block and popup) or the table pointer is null, the wrapper returns unavailable.

Threads ​

ThreadWhat runs on it
Flow threadVm_Update_FlowStateMachine each frame. Lifecycle, flow and career events, the on_frame tick and telemetry reads fire here; call the career library's game calls (entity, component, post) here
Render threadThe swapchain present path. on_paint callbacks fire here
Caller threaddb and storage calls run on the thread that calls them

You can use subscriptions, paint callbacks, and db and storage calls from any thread. Your callbacks must return at once, without blocking the thread they run on.

API versions ​

To see which version the running loader offers, read SwoftyApi::version. The header constant, SWOFTY_API_VERSION in swofty_api.h, is 8.

MembersOffered by
version, log, module_base, scanversion.dll, as version 1
resolve, register_mixins, fields, setting, watch_setting, assetsswofty_core.dll, as version 4
events, overlay, telemetry, db, storageswofty_core.dll, as version 5
careerswofty_core.dll 0.2.11, as version 6
popup, career->block, career->unblockswofty_core.dll 0.2.12, as version 7
langswofty_core.dll, as version 8

The helpers you use determine which version you need: the mixin helpers in mixin.hpp need version 2, the settings helpers version 3, assets.hpp version 4, the five table headers version 5, career.hpp version 6 (its block and unblock version 7), popup.hpp version 7, and lang.hpp version 8. mem.hpp needs no table.

Publishing