Skip to content

WASM Imports#

Every function the SDK calls is a WASM import provided by the Xenon host at runtime. This is the complete list of imports a standard plugin can use.

All imports use the "core" import module unless otherwise noted.

Core Imports#

Import Name SDK Wrapper Signature
log Log(msg) (i32) → void
get_time GetTime() () → f32
is_key_down IsKeyDown(vk) (i32) → i32
is_key_pressed IsKeyPressed(vk) (i32) → i32
is_key_released IsKeyReleased(vk) (i32) → i32
get_screen_width ScreenSize().x () → i32
get_screen_height ScreenSize().y () → i32
world_to_screen WorldToScreen(...) (f32, f32, f32, i32) → i32

Entity Imports#

Import Name SDK Wrapper Signature
get_entity_count GetPlayerCount() () → i32
get_entity Entity(index) (i32, i32) → void
get_local_player LocalPlayer() (i32) → void
get_bone_pos Entity::GetBonePos(id) (i32, i32, i32) → i32
is_entity_visible Entity::IsVisible() (i32) → i32
get_distance_to_entity Entity::GetDistance() (i32) → f32
find_best_target FindBestTarget(flags) (i32) → i32
get_distance (internal) (f32, f32, f32, f32, f32, f32) → f32
get_skeleton_connections GetSkeletonConnections(heroId, out) (i64, i32) → i32

Aim Imports#

Import Name SDK Wrapper Signature
aim_set_direction AimSetDirection(dir) (f32, f32, f32) → void
aim_get_direction AimGetDirection() (i32) → i32
aim_set_angles AimSetAngles(pitch, yaw) (f32, f32) → void
aim_get_angles AimGetAngles() (i32) → i32
aim_to AimAtPosition(target, stiffness) (f32, f32, f32, f32, f32) → void
aim_to_bone AimAtBone(idx, bone, stiffness) (i32, i32, f32, f32) → void
aim_reset_smoothing AimResetSmoothing() () → void
aim_hits_hitbox AimHitsHitbox(idx, scale) (i32, f32) → i32

Draw Imports#

Import Name SDK Wrapper Signature
draw_line Draw::Line(...) (f32, f32, f32, f32, f32, f32, f32, f32, f32) → void
draw_circle Draw::Circle(...) / CircleFilled(...) (f32, f32, f32, f32, f32, f32, f32, f32) → void
draw_rect Draw::Rect(...) / RectFilled(...) (f32, f32, f32, f32, f32, f32, f32, f32, f32) → void
draw_text Draw::Text(...) (f32, f32, i32, f32, f32, f32, f32, i32) → void

Draw Parameter Conventions#

  • Colors are passed as normalized floats (0.0-1.0 for R, G, B, A)
  • thickness = 0 means "filled" for circle and rect
  • Rect coordinates are min/max corners, not position/size (the SDK converts)
Import Name SDK Wrapper Signature
menu_checkbox ImGui::Checkbox(...) (i32, i32) → i32
menu_slider_int ImGui::SliderInt(...) (i32, i32, i32, i32) → i32
menu_slider_float ImGui::SliderFloat(...) (i32, i32, f32, f32) → i32
menu_combo ImGui::Combo(...) (i32, i32, i32) → i32
menu_text ImGui::Text(...) (i32) → void
menu_tooltip ImGui::Tooltip(...) (i32) → void
menu_separator ImGui::Separator() () → void
menu_collapsing_header ImGui::CollapsingHeader(...) (i32) → i32
menu_hotkey ImGui::Hotkey(...) (i32, i32) → i32

Config Imports#

Import Name SDK Wrapper Signature
config_set_int Config::SetInt(...) (i32, i32) → void
config_set_float Config::SetFloat(...) (i32, f32) → void
config_set_bool Config::SetBool(...) (i32, i32) → void
config_get_int Config::GetInt(...) (i32, i32) → i32
config_get_float Config::GetFloat(...) (i32, f32) → f32
config_get_bool Config::GetBool(...) (i32, i32) → i32
config_save Config::Save() () → void

Plugin Exports#

These are the functions your plugin exports to the host:

Export Name Entry Point Signature
on_get_info Plugin metadata (i32) → void
on_load Initialization () → void
on_unload Cleanup () → void
on_frame Game logic (f32) → void
on_render Drawing () → void
on_menu UI () → void
on_hero_changed Hero switch (i64) → void
on_perform_action Action callback (varies)

Library Imports#

Library dependencies use a dynamic import module: lib_<service_name>.

For example, a dependency on "math_helpers" generates imports like:

Module Import Name Signature
lib_math_helpers lerp (f32, f32, f32) → f32
lib_math_helpers clamp_f (f32, f32, f32) → f32
lib_math_helpers remap (f32, f32, f32, f32, f32) → f32

These are defined in the import header (include/xenon/libs/math_helpers.hpp).

WASM Types Reference#

Notation WASM Type C++ Type
i32 32-bit integer int32_t, uint32_t, pointers
i64 64-bit integer int64_t, uint64_t
f32 32-bit float float
f64 64-bit float double

In WASM, all pointers are i32 (32-bit address space).