DeltaLoaderDocs
  1. Home
  2. Developer Documentation
  3. API reference

API reference

The most used calls of the SDK. Every header is documented in its own comments.

All headers are in include/sw/ of the public repository. The comments in a header say what is proven and what is not. Every call that talks to the game fails closed: it returns false or nullptr when the game does not match.

The complete header reference (every header with its comments, recipes, generated tables) is the API wiki.

Mod framework sw::mod (sw/mod.hpp)#

CallPurpose
SW_MOD("name")Declares the mod (export of name, shutdown and the DLL entry point).
void sw_mod_start() / void sw_mod_stop()You write these. Start runs on its own thread.
bool sw::mod::running()False as soon as the mod should unload.
bool sw::mod::sleep(unsigned ms)Waits; returns false if unloading begins.
Runtime& sw::mod::rt()The runtime of the game (already connected and checked).
void sw::mod::log(fmt, ...)Console window and log file.

Runtime sw::Runtime (sw/runtime.hpp)#

CallPurpose
hook_api / hook_ctor / hook_method / hook_rvaInstall hooks (see Events and hooks).
resolve(api)The address of a mapped Lua handler.
readable(ptr, size)Is this memory readable?
read_rva<T> / write_rva<T> / write_bytesRead or write game memory. Writing changes the game.
class_of(obj) / is_instance_of(obj, cls) / class_vtable(cls)Identify objects by their vtable.
is_function_start(addr)Is this the start of a function in the main module?

Objects sw::Instances (sw/instances.hpp)#

CallPurpose
track(cls, err)Start watching the constructors of a class.
list(cls)Addresses of the live objects.
untrack(cls) / tracked()Stop watching / what is watched.

Friendly headers#

HeaderGives
tiles.hpp, start_tiles.hpp, world.hppTile system, your own start card, islands
weather.hppWeather, wind, time of day
render.hppFrame end, OpenGL, shaders, uniforms, render targets
audio.hpp, input.hpp, camera.hpp, physics.hppAudio engine, input callbacks, cameras, the physics world
vehicle.hppSpawned vehicles and components (read only)
vfs.hpp, overlay.hppMod folders in the game without writing
network.hpp, game_state.hppMessage ids and application states
flags.hpp, mapicons.hpp, textures.hpp, mesh.hpp, trees.hppFlags, map icons, textures, meshes, trees
discord.hppDiscord Rich Presence

Documentation for game build 1.15.26. Found a mistake? Open an issue.