GRW ScriptHook 0.11.0
Plugin API for Ghost Recon Wildlands
Loading...
Searching...
No Matches
scripthook.h File Reference

GRW ScriptHook plugin API from dinput8.dll. More...

#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  ShVec3
 Metres. More...
struct  ShPlayer
 root is the top of the parent chain, and the only position that survives a direct write. More...
struct  ShEntity
struct  ShComponent
 Components. More...
struct  ShVehicle
struct  ShNpcArchetype
struct  ShRay
 dir is a full length vector, so origin + dir is the end of the trace rather than a unit direction. More...
struct  ShRayQuery
 A query over the recorded rays. More...
struct  ShHit
 Bullets often strike a child part, so root is resolved for you and is the one worth acting on. More...
struct  ShShot
 A shot, reported on the projectile's first step. More...
struct  ShCamera
 Rows of the pose matrix: right, forward, up, then position. More...
struct  ShCameraOverride
struct  ShMethod
 An object is [vtable, methodTable, ...]; the table is 32 byte entries of crc32(name), index and function. More...
struct  ShUiEvent

Macros

#define SH_API_VERSION   1
#define SH_API
#define SH_STREAM_RADIUS   1500.0f
 Collision exists only near the player.
#define SH_FIND_UNNAMED   0x1
 Untyped entries are scenery logic and markers, so they are hidden unless this flag is passed.
#define SH_EVT_MINE_ONLY   0x1
 Flags on the subscription.
#define SH_EVT_NO_SELF   0x2
#define SH_INPUT_KEYS   0x01
 every key
#define SH_INPUT_MOVE   0x02
 WASD, space, shift, ctrl.
#define SH_INPUT_FIRE   0x04
 left mouse
#define SH_INPUT_AIM   0x08
 right mouse
#define SH_INPUT_LOOK   0x10
 mouse aiming
#define SH_CAM_POS   0x01
 Everything the camera object exposes, in one call.
#define SH_CAM_ROT   0x02
#define SH_CAM_FOV   0x04
#define SH_CAM_SKEW   0x08
#define SH_CAM_MODE   0x10
#define SH_RES_FOOD   0
 The four crafting resources, by name.
#define SH_RES_GASOLINE   1
#define SH_RES_MEDICINE   2
#define SH_RES_COMMS   3
#define SH_HASH_ENTER   0x78B1EF6Au
 crc32 of the method names the scene calls rely on.
#define SH_HASH_EXIT   0x343B2B30u
#define SH_HASH_INIT   0x66464B4Au
#define SH_HASH_SHUTDOWN   0x6CD4BC94u
#define SH_HASH_GAMEOVER   0xCA671D0Au
 GameFlow, reason.
#define SH_FLOW_GAMEOVER_SCENE   9
 Its sub objects, slots 0 to 16.
#define SH_FLOW_ALT_SCENE   11
#define SH_PT_FLOAT   1
 Properties by the engine's own ids, typed from its property tables at runtime.
#define SH_PT_BOOL   2
#define SH_PT_UINT   3
#define SH_PT_VEC2   4
#define SH_PT_VEC3   5
#define SH_PT_STRING   6
#define SH_P_POSITION   0x01
 Widget vec3, local position.
#define SH_P_ROTATION3   0x02
 Widget vec3.
#define SH_P_ROTATION   0x03
 Widget float, degrees.
#define SH_P_COLOUR   0x05
 Widget vec3, 0..255.
#define SH_P_ALPHA   0x06
 Widget float, 0..1.
#define SH_P_VISIBLE   0x07
 Widget bool.
#define SH_P_SCALE   0x35
 Widget vec3.
#define SH_P_TEXT   0x08
 Label string.
#define SH_P_AUTOSIZE   0x09
 Label bool.
#define SH_P_STYLE   0x0A
 Label string.
#define SH_P_FONTSIZE   0x0C
 Label float.
#define SH_P_LINEGAP   0x0E
 Label float.
#define SH_P_SIZE   0x0F
 Label vec2.
#define SH_P_IMAGE   0x2A
 Image string.
#define SH_P_UV0   0x38
 Image vec2.
#define SH_P_UV1   0x39
 Image vec2.
#define SH_P_CONTSIZE   0x3E
 Container vec2.
#define SH_W_CONTAINER   1
 Widget classes for ShUiCreate.
#define SH_W_LABEL   2
#define SH_W_IMAGE   3
#define SH_W_PANEL   4
#define SH_UI_EV_DOWN   1
 Input: the focused scene gets keys and pointer moves and captures the keyboard (only Esc, Alt, Tab, F4 and the Windows keys reach the game).
#define SH_UI_EV_UP   2
#define SH_UI_EV_MOVE   3
#define SH_SCENE_DRONE   "HUD_Drone"
 The game's UI state, from the scenes it drew last frame.
#define SH_SCENE_BINOCULAR   "HUD_Binocular"
#define SH_SCENE_VEHICLE   "HUD_Vehicle"
#define SH_SCENE_PAUSE   "Menu_TabbedPage"
#define SH_SCENE_LOADOUT   "MENU_LoadoutV2"
#define SH_SCENE_MAP   "MENU_Map_Cursor"
#define SH_SCENE_SKILLS   "MENU_Skills"
#define SH_SCENE_COMWHEEL   "HUD_ComWheel"
#define SH_SCENE_GAMEOVER   "MENU_GameOver"
#define SH_SCENE_LOADING   "MENU_LoadingScreen"
#define SH_SCENE_CINEMATIC   "HUD_Cinematic"

Typedefs

typedef int(*) ShLastError_t(void)
typedef const char *(*) ShErrorString_t(int err)
typedef int(*) ShGetVersion_t(void)
typedef int(*) ShGetPlayer_t(ShPlayer *out)
typedef int(*) ShTeleportPlayer_t(const ShVec3 *pos, const ShVec3 *orient)
typedef int(*) ShWalkToRoot_t(uint64_t entity, uint64_t *outRoot)
typedef int(*) ShGetPlayerPosition_t(ShVec3 *out)
typedef void(*) ShInvalidate_t(void)
typedef void(*) ShFrameFn_t(void *user)
 A per frame hook on the game thread.
typedef void(*) ShHitFn(const ShHit *hit, void *user)
 Receivers run on a worker thread the API owns, so any API call is safe from inside one.
typedef void(*) ShFireFn(const ShShot *shot, void *user)
typedef void(*) ShMenuFn(uint32_t menu, uint32_t item, int value, void *user)
typedef int(*) ShGetGameState_t(void)
typedef int(*) ShIsInGame_t(void)
typedef int(*) ShUiInputFn(uint32_t scene, const ShUiEvent *e, void *user)
typedef int(*) ShGetHealthPlayer_t(uint32_t *, uint32_t *)
typedef int(*) ShSetHealthPlayer_t(uint32_t)
typedef int(*) ShSetGodModePlayer_t(int)
typedef int(*) ShPhysicsReady_t(void)
typedef int(*) ShGroundHeight_t(float, float, float *)
typedef int(*) ShTeleportPlayerToGround_t(float, float, float)

Enumerations

enum  ShGameState {
  SH_STATE_UNKNOWN = 0 , SH_STATE_MENU , SH_STATE_LOADING , SH_STATE_LOBBY ,
  SH_STATE_INGAME , SH_STATE_RELOADING , SH_STATE_PAUSED , SH_STATE_GAMEOVER ,
  SH_STATE_DRONE , SH_STATE_BINOCULAR , SH_STATE_CINEMATIC
}
enum  ShUiState {
  SH_UI_DRONE = 0x0001 , SH_UI_BINOCULAR = 0x0002 , SH_UI_VEHICLE = 0x0004 , SH_UI_PAUSE = 0x0008 ,
  SH_UI_LOADOUT = 0x0010 , SH_UI_MAP = 0x0020 , SH_UI_SKILLS = 0x0040 , SH_UI_COMWHEEL = 0x0080 ,
  SH_UI_GAMEOVER = 0x0100 , SH_UI_LOADING = 0x0200 , SH_UI_CINEMATIC = 0x0400 , SH_UI_POPUP = 0x0800
}
 What the game's UI is showing, from the scenes it drew last frame. More...
enum  ShError {
  SH_OK = 0 , SH_ERR_BAD_ARG , SH_ERR_NO_GLOBAL , SH_ERR_NO_POSITION ,
  SH_ERR_NO_CANDIDATE , SH_ERR_NO_ROOT , SH_ERR_UNWRITABLE , SH_ERR_NOT_ENTITY ,
  SH_ERR_HOOK_FAILED , SH_ERR_NO_PHYSICS , SH_ERR_NO_GROUND , SH_ERR_NOT_IN_GAME ,
  SH_ERR_NOT_STREAMED , SH_ERR_CONTROLLER , SH_ERR_UI_NOT_READY , SH_ERR_UI_PROP ,
  SH_ERR_UI_ASSET
}
 Every int function returns 1 on success, 0 on failure, and on failure ShLastError carries one of these. More...
enum  ShEntityKind {
  SH_KIND_ANY = 0 , SH_KIND_PLAYER , SH_KIND_NPC , SH_KIND_VEHICLE ,
  SH_KIND_DRONE , SH_KIND_TEAMMATE , SH_KIND_TURRET , SH_KIND_MINE ,
  SH_KIND_DOOR , SH_KIND_LOOTCHEST , SH_KIND_OTHER
}
 Entity kinds, from the engine's own net identity component. More...
enum  ShRayMode { SH_RAY_OFF = 0 , SH_RAY_ALL , SH_RAY_DIRECTED }
enum  { SH_HUD_TOPLEFT = 0 , SH_HUD_TOPRIGHT , SH_HUD_BOTTOMLEFT , SH_HUD_BOTTOMRIGHT }
enum  ShWeather {
  SH_WEATHER_SUNNY = 0 , SH_WEATHER_CLOUDS_LIGHT , SH_WEATHER_CLOUDS_HEAVY , SH_WEATHER_FOG ,
  SH_WEATHER_RAIN_LIGHT , SH_WEATHER_RAIN_HEAVY
}
 Weather type, blended by the engine over its default ten seconds. More...

Functions

SH_API uint32_t ShGetUiState (void)
SH_API int ShInDrone (void)
SH_API int ShInLoadout (void)
SH_API int ShInMap (void)
SH_API int ShInBinocular (void)
SH_API int ShLastError (void)
 The last error for the calling context.
SH_API const char * ShErrorString (int err)
 The readable name of an error code.
SH_API int ShGetVersion (void)
 SH_API_VERSION, for compatibility checks.
SH_API int ShGetPlayer (ShPlayer *out)
 The local player.
SH_API int ShGetPlayerPosition (ShVec3 *out)
 The soldier's own position, from its matrix.
SH_API int ShGetCameraEyePosition (ShVec3 *out)
 Where the player global says the view sits, about 1.9m behind and 1.6m above the body in third person.
SH_API int ShTeleportPlayer (const ShVec3 *pos, const ShVec3 *orient)
 Teleport the player, at any range.
SH_API int ShTeleportPlayerHops (const ShVec3 *pos, const ShVec3 *orient, float hopMetres, int delayMs)
 Teleport in hops rather than one jump, for when a single long move misbehaves.
SH_API int ShIsInVehicle (void)
 True while riding a vehicle, read from the entity link in the parent chain.
SH_API int ShPlaceEntity (uint64_t entity, const ShVec3 *pos, const ShVec3 *orient)
 Place any entity through the engine's set transform.
SH_API int ShPlaceEntityRot (uint64_t entity, const ShVec3 *pos, float yaw, float pitch, float roll)
 Full orientation in radians, which ShPlaceEntity cannot express: roll puts a car on its roof.
SH_API int ShGetEntityTransform (uint64_t entity, ShVec3 *pos, float *yaw, float *pitch, float *roll)
 Its inverse: where a thing is and how it is turned, so a caller can rotate relative to that.
SH_API int ShQueueTransform (uint64_t entity, const ShVec3 *pos, float yaw, float pitch, float roll)
 Applied on the frame path rather than right now.
SH_API int ShFindEntities (int kind, float radius, uint32_t flags, ShEntity *out, int max)
 Fills out with entities within radius of the player, nearest first.
SH_API int ShGetEntityKind (uint64_t entity)
 Kind of one entity.
SH_API const char * ShKindName (int kind)
 The readable name of a kind.
SH_API int ShGetComponents (uint64_t entity, ShComponent *out, int max)
 Fills out with the entity's components, returning how many were written.
SH_API uint64_t ShFindComponent (uint64_t entity, uint32_t classHash)
 The component of a given class, or 0.
SH_API int ShQueueCall (uint64_t fn, uint64_t a0, uint64_t a1, uint64_t a2, uint64_t a3)
 Run an engine call on the GAME THREAD.
SH_API int ShQueueCallF (uint64_t fn, uint64_t a0, uint64_t a1, float f2, float f3, float f4)
 Args three to five as floats, which the ABI passes in xmm2, xmm3 and the stack rather than the int registers.
SH_API int ShQueueResult (uint64_t *outRet)
SH_API int ShVehicleCount (void)
 The catalogue, named one spawn at a time by eye.
SH_API const ShVehicle * ShVehicleAt (int index)
SH_API const char * ShVehicleName (uint32_t vehicleId)
SH_API uint64_t ShSpawnVehicle (uint32_t vehicleId, const ShVec3 *pos)
 Spawn a vehicle and return its ENTITY, or 0 on failure.
SH_API void ShSpawnInvalidate (void)
SH_API int ShReadBytes (uint64_t addr, void *out, uint32_t len)
 Guarded reads, for anything walking engine memory.
SH_API uint64_t ShReadU64 (uint64_t addr, int *ok)
SH_API float ShReadF32 (uint64_t addr, int *ok)
SH_API int ShRegisterFrameCallback (ShFrameFn_t fn, void *user)
SH_API void ShUnregisterFrameCallback (ShFrameFn_t fn)
SH_API int ShTriggerLightning (void)
 One lightning strike, queued in the weather system.
SH_API float ShGetWetness (void)
 The live ground wetness.
SH_API int ShSetLightningFrequency (int enable, float value)
 Override the lightning rate, or 0 to hand it back.
SH_API int ShSetGodMode (int on)
 The player's own god and ghost bytes.
SH_API int ShSetGhostMode (int on)
SH_API int ShGetGodMode (void)
SH_API int ShExplosionShield (const ShVec3 *at, float radius)
 A sphere explosions ignore.
SH_API int ShSetEntityPhysics (uint64_t entity, int on)
 Physics bodies on or off for one entity.
SH_API int ShAttachEntity (uint64_t child, uint64_t parent, const ShVec3 *offset)
 The child follows the parent at an offset.
SH_API int ShDetachEntity (uint64_t child)
SH_API int ShNpcCount (void)
 The archetype registry, read once per session on first use.
SH_API const ShNpcArchetype * ShNpcAt (int index)
SH_API uint64_t ShSpawnNpc (uint64_t archetypeId, const ShVec3 *pos)
 Spawn an NPC and return its ENTITY, or 0 on failure.
SH_API int ShDespawn (uint64_t entity)
 Retire a spawned entity, NPC or vehicle, through the spawn manager.
SH_API int ShWalkToRoot (uint64_t entity, uint64_t *outRoot)
 Walk an entity's parent chain to its root.
SH_API void ShInvalidate (void)
 Drop the cached player, so the next call re-resolves.
SH_API void ShRayFilter (const ShVec3 *from, float radius, float minLength)
 The engine casts about 100k rays a second, so an unfiltered ring holds only a few milliseconds.
SH_API void ShRayFilterPlayer (float radius, float minLength)
 Track the player instead.
SH_API void ShRayLog (int mode)
 Recording is off by default: it costs a copy on every cast, and the engine casts a great many per frame.
SH_API uint32_t ShRayCount (void)
SH_API int ShGetRays (ShRay *out, int max)
 Fills out with the most recent rays, newest first.
SH_API int ShQueryRays (const ShRayQuery *q, ShRay *out, int max)
 Newest first, only the rays matching the query.
SH_API int ShHitHookInstall (void)
 Install the hook.
SH_API int ShHitHookReady (void)
SH_API int ShOnHit (ShHitFn fn, void *user, int flags)
 Register a receiver, up to eight.
SH_API int ShOffHit (ShHitFn fn)
 Remove one receiver, or all of them when fn is NULL.
SH_API uint32_t ShHitCount (void)
 A ring, for callers that would rather poll.
SH_API int ShGetHits (ShHit *out, int max)
SH_API int ShOnFire (ShFireFn fn, void *user, int flags)
 Register a receiver for shots, up to eight.
SH_API int ShOffFire (ShFireFn fn)
SH_API uint32_t ShShotCount (void)
SH_API int ShGetShots (ShShot *out, int max)
SH_API int ShSetVisible (uint64_t entity, uint64_t node, int visible, int persist)
 node 0 means the whole entity.
SH_API int ShEntityNodeCount (uint64_t entity)
SH_API int ShGetEntityNodes (uint64_t entity, uint64_t *out, int max)
 Enumerate parts, so a caller can hide any subset.
SH_API int ShGetHeadNodes (uint64_t entity, uint64_t *out, int max)
 The group appears the first time the player aims, so 0 is normal until then.
SH_API uint32_t ShMenuCreate (const char *title)
 A top level entry for your plugin.
SH_API uint32_t ShMenuSub (uint32_t parent, const char *label)
SH_API int ShMenuAction (uint32_t menu, const char *label, ShMenuFn fn, void *user)
SH_API int ShMenuToggle (uint32_t menu, const char *label, int initial, ShMenuFn fn, void *user)
SH_API int ShMenuNumber (uint32_t menu, const char *label, float initial, float lo, float hi, float step, ShMenuFn fn, void *user)
SH_API int ShMenuList (uint32_t menu, const char *label, const char **opts, int n, int initial, ShMenuFn fn, void *user)
 opts must outlive the menu.
SH_API int ShMenuClear (uint32_t menu)
 Drop a menu's items, keeping the row, so a plugin can rebuild its own menu without stacking duplicates.
SH_API int ShMenuDestroy (uint32_t menu)
 Remove the row and its subtree.
SH_API int ShMenuStatus (uint32_t menu, const char *text)
 The line under the items.
SH_API void ShMenuSetKey (int vk)
SH_API int ShMenuIsOpen (void)
SH_API void ShMenuOpen (int open)
SH_API uint32_t ShHudCreate (const char *name, int anchor, int priority)
 Register a line.
SH_API int ShHudSet (uint32_t hud, const char *text)
 Text may hold newlines.
SH_API int ShHudColour (uint32_t hud, uint32_t rgb)
SH_API int ShHudShow (uint32_t hud, int visible)
SH_API void ShHudDestroy (uint32_t hud)
SH_API int ShCameraHookInstall (void)
 Redirect the selector thunk.
SH_API int ShCameraReady (void)
SH_API uint64_t ShCameraCalls (void)
SH_API uint64_t ShCameraWrites (void)
SH_API int ShInPauseMenu (void)
 The game flow stays in Playing while paused, so this is read off the camera: the pause menu renders through a template pose no steered camera ever holds.
SH_API int ShSetCameraBlur (int on)
 The close range body blur, a hidden proximity fade the menu's DoF settings leave running.
SH_API int ShCameraBlurOff (void)
SH_API int ShGetVelocity (uint64_t entity, ShVec3 *out)
 Pass an entity, never a body id: an entity owns several bodies and these calls write every one of them.
SH_API int ShSetVelocity (uint64_t entity, const ShVec3 *v)
SH_API int ShAddVelocity (uint64_t entity, const ShVec3 *v)
SH_API int ShGetAngularVelocity (uint64_t entity, ShVec3 *out)
 Radians a second about each world axis.
SH_API int ShSetAngularVelocity (uint64_t entity, const ShVec3 *v)
SH_API int ShAddAngularVelocity (uint64_t entity, const ShVec3 *v)
SH_API int ShShove (uint64_t entity, const ShVec3 *dir, float strength, const ShVec3 *atWorldPos)
 A push at a world point, shoving and spinning like a hit on a corner.
SH_API int ShCanMove (uint64_t entity)
 True when velocity moves this entity.
SH_API uint64_t ShHavokWorld (void)
SH_API uint32_t ShGetBodyId (uint64_t entity)
SH_API int ShHavokScan (int *bodies, int *owners, int *mapped)
SH_API int ShBlockInput (uint32_t mask)
 Alt, Tab, Esc, F4 and Win always get through.
SH_API uint32_t ShBlockedInput (void)
SH_API int ShSetCrashIntercept (int on)
 Watch faults first and resume ones with a null path.
SH_API int ShCrashInterceptOn (void)
SH_API int ShCrashCount (void)
 How many crashes have been caught this session.
SH_API int ShCrashHealed (void)
 How many were resumed on the engine's own null path, which the player never sees.
SH_API int ShCrashReport (char *buf, int len)
 The first report of the session, as text.
SH_API int ShSetCrashFreeze (int on)
 Freeze parks the faulting thread instead of dying, for a live post mortem.
SH_API int ShCrashFreezeOn (void)
SH_API int ShGetCamera (ShCamera *out)
 Where the camera is, and how it is pointed.
SH_API int ShSetCamera (const ShVec3 *pos)
 The engine rebuilds the camera every frame, so an override is reapplied until it is released.
SH_API int ShCameraOrbit (float back, float up)
SH_API int ShCameraFree (const ShVec3 *pos, float yaw, float pitch)
 Free camera.
SH_API int ShCameraAngles (float *yaw, float *pitch)
SH_API void ShCameraRelease (void)
SH_API void ShCameraReleaseFields (uint32_t fields)
 Ownership is per field, so plugins compose.
SH_API uint32_t ShCameraOwned (void)
SH_API int ShCameraFirstPerson (float forward, float up)
 First person: the eye tracks the head bone every frame and eases onto the aim ray during ADS, so sights stay centered.
SH_API int ShGetHeadPosition (ShVec3 *out)
 The head in world space, from the bone named Head.
SH_API int ShHeadBone (void)
SH_API int ShCameraApply (const ShCameraOverride *o)
 Reapplied every frame until ShCameraRelease.
SH_API int ShCameraMatrix (int index, float *out16)
 The nine derived matrices at camera+0x420, view and projection and their inverses.
SH_API int ShGetGameState (void)
 Game flow state.
SH_API int ShIsInGame (void)
 Stays true while paused: the world is loaded and every read keeps working, so callers keep their state on Esc.
SH_API int ShGetGameStateName (char *buf, int len)
SH_API int ShPhysicsReady (void)
 Predicate only, never installs anything.
SH_API int ShGroundHeight (float x, float y, float *outZ)
SH_API int ShGroundHeightFrom (float x, float y, float nearZ, float *outZ)
 Probe from a given height, for stacked geometry like bridges and caves.
SH_API int ShTeleportPlayerToGround (float x, float y, float clearance)
SH_API int ShGetHealthPlayer (uint32_t *cur, uint32_t *max)
 Health, local player.
SH_API int ShSetHealthPlayer (uint32_t value)
SH_API int ShSetGodModePlayer (int on)
SH_API int ShDamagePlayer (uint32_t amount)
 Damage through the engine's own path, so death runs its real sequence.
SH_API int ShKillPlayer (void)
SH_API int ShSetCannotDiePlayer (int on)
 Floors at the downed state instead of dying.
SH_API void ShInvalidateHealth (void)
SH_API int ShGetHealthEntity (uint64_t entity, uint32_t *cur, uint32_t *max)
 Entity targeted variants.
SH_API int ShSetHealthEntity (uint64_t entity, uint32_t value)
SH_API int ShSetGodModeEntity (uint64_t entity, int on)
SH_API int ShStatRead (uint64_t stat, uint32_t *out)
 Protected ints, the general stat storage: four bit planes and an XOR key.
SH_API int ShStatWrite (uint64_t stat, uint32_t value)
SH_API int ShGetResource (int which, uint32_t *out)
SH_API int ShSetResource (int which, uint32_t value)
SH_API int ShSetAllResources (uint32_t value)
SH_API int ShGetSkillPoints (uint32_t *out)
 Skill points, a plain int rather than a protected one.
SH_API int ShSetSkillPoints (uint32_t value)
SH_API int ShSetVisibility (float factor)
 Visibility to enemies.
SH_API int ShGetVisibility (float *out)
SH_API int ShGetAmmo (int slot, uint32_t *out)
 Ammo by weapon slot: 0 primary, 1 second, 2 sidearm.
SH_API int ShSetAmmo (int slot, uint32_t value)
SH_API int ShSetWeather (int type)
SH_API int ShSetWeatherBlend (int type, float seconds)
 The same, blended over seconds.
SH_API int ShReleaseWeather (void)
 Hand the weather back to the ambient system.
SH_API int ShGetWeather (int *out)
SH_API int ShSetTime (float hours)
 Time of day in hours past midnight, 0 to 24.
SH_API int ShGetTime (float *out)
SH_API int ShSetTimeSpeed (float multiplier)
 Clock rate.
SH_API int ShGetTimeSpeed (float *out)
SH_API int ShReflectMethod (uint64_t obj, uint32_t nameHash, uint64_t *outFn)
 The function behind a method name, 0 when absent.
SH_API int ShReflectMethods (uint64_t obj, ShMethod *out, int max)
 Every method of the object's class, in table order.
SH_API uint32_t ShReflectClassHash (uint64_t obj)
 The class hash, through the descriptor getter.
SH_API int ShReflectCall (uint64_t obj, uint32_t nameHash, uint64_t a1, uint64_t a2, uint64_t a3, uint64_t *outRet)
 Call a method by name on the game thread and wait.
SH_API int ShSceneEnter (uint64_t obj)
 A scene is any reflected object with Enter and Exit.
SH_API int ShSceneExit (uint64_t obj)
SH_API uint64_t ShGameFlow (void)
 The GR_GameFlow machine, identity checked.
SH_API uint64_t ShGameFlowObject (int slot)
SH_API uint64_t ShHybridMenu (void)
 The HybridMenu, the shell every menu page lives in.
SH_API int ShTriggerGameOver (int reason)
 The real thing: death, card and checkpoint reload.
SH_API int ShUiReady (void)
 1 once the world is up; poll before building.
SH_API void ShUiEnable (int on)
 Kill switch, on by default.
SH_API int ShUiSetDefaultFont (const char *guid)
 Font and plate texture for new widgets, by asset GUID ("873fe53f-3b90-db4d-9887-d3cc6edeaba9", storage order).
SH_API int ShUiSetDefaultImage (const char *guid)
SH_API int ShUiGen (void)
 Changes when the scene reloads; older ids are dead.
SH_API uint64_t ShSceneHandle (void)
 The phoenix::Scene handle that hosts every ShUi widget, built and driven by the DLL itself; 0 until in game.
SH_API uint32_t ShUiPanel (float x, float y, float w, float h, uint32_t rgb, float alpha)
 A container with a translucent quad behind it.
SH_API uint32_t ShUiLabel (uint32_t panel, float x, float y, float w, float h, const char *text, uint32_t rgb)
 A line of text in the HUD font.
SH_API uint32_t ShUiImage (uint32_t panel, float x, float y, float w, float h, uint32_t rgb, float alpha)
 A tinted quad, for bars and highlights.
SH_API int ShUiSetText (uint32_t id, const char *text)
SH_API int ShUiSetPos (uint32_t id, float x, float y)
SH_API int ShUiSetSize (uint32_t id, float w, float h)
SH_API int ShUiSetColour (uint32_t id, uint32_t rgb)
SH_API int ShUiSetAlpha (uint32_t id, float alpha)
SH_API int ShUiShow (uint32_t id, int visible)
 Hiding a panel hides its children too.
SH_API int ShUiDestroy (uint32_t id)
 Detaches the widget and its children from the tree.
SH_API uint32_t ShUiCreate (uint32_t parent, int cls, float x, float y, float w, float h)
 Any widget under any container (0 = the scene root), at any depth.
SH_API int ShUiPropType (uint32_t id, uint32_t prop)
 0 when the widget's class has no such property.
SH_API int ShUiSetF (uint32_t id, uint32_t prop, float v)
SH_API int ShUiSetU (uint32_t id, uint32_t prop, uint32_t v)
SH_API int ShUiSetV (uint32_t id, uint32_t prop, const float *v, int n)
SH_API int ShUiSetS (uint32_t id, uint32_t prop, const char *utf8)
SH_API int ShUiGetF (uint32_t id, uint32_t prop, float *out)
SH_API int ShUiGetU (uint32_t id, uint32_t prop, uint32_t *out)
SH_API int ShUiGetV (uint32_t id, uint32_t prop, float *out, int n)
SH_API int ShUiGetS (uint32_t id, uint32_t prop, char *out, int n)
SH_API int ShUiSetAutoSize (uint32_t id, int autoW, int autoH)
 Label size follows its text on the axes set to 1.
SH_API int ShUiMeasure (uint32_t id, float *w, float *h)
 The label's laid out box: its text bounds once an axis is automatic, otherwise the size that was set.
SH_API uint32_t ShUiTextureCreate (int w, int h, const uint8_t *rgba, int stride)
 RGBA8 pixels to an engine texture, stride in bytes.
SH_API int ShUiImageSet (uint32_t id, uint32_t texture)
 Shows a texture on an image widget or panel plate.
SH_API int ShUiPropCount (void)
 The resolved property records: class, id, type.
SH_API int ShUiPropAt (int i, char *cls, int n, uint32_t *prop, int *type)
SH_API uint32_t ShUiSceneCreate (const char *name, int order)
 Scenes: layers of your own.
SH_API int ShUiSceneSetOrder (uint32_t scene, int order)
SH_API int ShUiSceneShow (uint32_t scene, int visible)
SH_API int ShUiSceneDestroy (uint32_t scene)
 Every widget of the scene, then the scene.
SH_API uint32_t ShUiCreateIn (uint32_t scene, uint32_t parent, int cls, float x, float y, float w, float h)
 A widget in a scene; parent 0 is that scene's root.
SH_API int ShUiSetReset (uint32_t scene, void(*fn)(uint32_t scene, void *user), void *user)
 After a world reload, once the scene is back: the old widgets are gone, rebuild inside.
SH_API int ShUiBegin (void)
 Edits between Begin and Commit run as one job.
SH_API int ShUiCommit (void)
SH_API int ShUiAbort (void)
SH_API int ShUiCommitAsync (void(*done)(int ok, void *user), void *user)
 Commit from a worker; done(ok, user) when it landed.
SH_API int ShUiReparent (uint32_t id, uint32_t parent, int index)
 Tree: move a widget under another container of the same scene at a sibling index (draw order); list children.
SH_API int ShUiChildCount (uint32_t id)
SH_API uint32_t ShUiChildAt (uint32_t id, int index)
SH_API int ShUiSetInput (uint32_t scene, ShUiInputFn fn, void *user)
SH_API int ShUiFocus (uint32_t scene, int take)
SH_API uint32_t ShUiFocused (void)
SH_API int ShBlockKey (int vk, int on)
 One virtual key hidden from the game until released.
SH_API int ShCaptureKeys (int on)
 Every key but the escapes hidden, focus uses this.
SH_API int ShGameSceneActive (const char *name)
 1 when a scene of that name was drawn last frame.
SH_API int ShGameScenes (char *buf, int n)
 Comma separated names drawn last frame; the count.
SH_API int ShGameSceneCount (void)
 Read only.
SH_API uint64_t ShGameSceneAt (int i)
SH_API int ShGameSceneName (uint64_t scene, char *buf, int n)
SH_API uint64_t ShSceneRoot (uint64_t scene)
 The root widget of any scene, ours or the game's.
SH_API int ShWidgetChildCount (uint64_t widget)
 Children in the engine's own draw order.
SH_API uint64_t ShWidgetChildAt (uint64_t widget, int i)
SH_API int ShWidgetClass (uint64_t widget, char *out, int n)
 The class name, "LabelWidget" and the like.
SH_API int ShWidgetPropType (uint64_t widget, uint32_t prop)
 Any property the class has, by the same ids the SH_P_ defines carry.
SH_API int ShWidgetGetF (uint64_t widget, uint32_t prop, float *out)
SH_API int ShWidgetGetU (uint64_t widget, uint32_t prop, uint32_t *out)
SH_API int ShWidgetGetV (uint64_t widget, uint32_t prop, float *out, int n)
SH_API int ShWidgetGetS (uint64_t widget, uint32_t prop, char *out, int n)
SH_API uint64_t ShUiHandle (uint32_t id)
 The handle behind one of our own ids, so a widget made with ShUiCreate reads back the same way.

Detailed Description

GRW ScriptHook plugin API from dinput8.dll.

Addresses resolve once at init and are cached.

Function Documentation

◆ ShSetCrashIntercept()

SH_API int ShSetCrashIntercept ( int on)

Watch faults first and resume ones with a null path.

Off by default: it breaks titles that fault on purpose.

◆ ShCrashInterceptOn()

SH_API int ShCrashInterceptOn ( void )