// This file is part of ClassicAPI.
//
// ClassicAPI is free software: you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software Foundation, either
// version 3 of the License, or (at your option) any later version.
//
// ClassicAPI is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along with
// ClassicAPI. If not, see .
#pragma once
enum Offsets {
// `.text` section bounds of this client (VA; see CLAUDE.md "Target
// binary"). Code scans read only inside them.
SECTION_TEXT_START = 0x00401000,
SECTION_TEXT_END = 0x007FEDAC,
FUN_FRAME_SCRIPT_INITIALIZE = 0x7039E0,
FUN_INVALID_FUNCTION_PTR_CHECK = 0x42A320,
FUN_LOAD_SCRIPT_FUNCTIONS = 0x490250,
// Fatal-error dispatcher. `__fastcall(uint code)`. Writes `code`
// to `DAT_00882738` and chains into the process-teardown path;
// `FUN_00403BC0` reads the code at exit and shows a localized
// popup keyed off it. Code `10` = "interface files are corrupt"
// — the engine fires this from FrameXML's `FUN_0048FBF0` hash
// mismatch and per-addon `FUN_0051F240` hash mismatch (plus
// other call sites we haven't pinned down by byte pattern).
// Hooked by `Security::FrameXMLBypass` to suppress code 10 so
// our in-memory file modifications (Bindings.xml splice +
// embedded `!!!ClassicAPI` addon) don't trigger termination.
FUN_FATAL_ERROR = 0x00401560,
// Master glue Lua init — clean linear caller of all 5 glue batch
// trampolines (60 main + 11 char-select + 24 char-create + 10 realm
// + 4 frame globals = 109 total). Body: 0x0046ABB0..0x0046ABD2,
// 35 bytes, single caller (FUN_0046A7B0). Runs once per glue boot:
// initial launch and every world→glue return (log out). Post-hook
// is the glue analog of `FUN_LOAD_SCRIPT_FUNCTIONS` — by the time
// it returns, `VAR_LUA_STATE` points at the freshly populated glue
// state, so `FrameScript_RegisterFunction` writes land on it.
FUN_LOAD_GLUE_SCRIPT_FUNCTIONS = 0x0046ABB0,
// Binding manager internals used by the direct-action/override binding backport.
//
// Stock Lua `SetBinding` wrapper (`int __fastcall(lua_State *)`).
// The SetBindingSpell/Item/Macro/Click wrappers delegate to it after
// constructing their action command, preserving punctuation-key
// normalization, current-set selection, the Boolean return value, and the
// native UPDATE_BINDINGS notification.
FUN_SCRIPT_SET_BINDING = 0x004B8000,
// Hardware-key dispatch, before the normal binding table is resolved:
// int __thiscall(manager, key, isDown)
// Hooking here lets owner-scoped override bindings remain a separate
// layer rather than temporarily mutating the character/account binding
// table. The normal dispatcher is called unchanged when no override wins.
FUN_BINDING_KEY_DISPATCH = 0x004B7990,
// Executes a resolved binding command:
// int __thiscall(manager, command, isDown)
// Vanilla has no SPELL/ITEM/MACRO/CLICK direct-action command handlers. The
// hook recognizes those four families and delegates every native command
// to the client.
FUN_BINDING_COMMAND_EXECUTE = 0x004B7B50,
// Binding-manager `this`-relative flag, set to 1 while a resolved binding
// command runs. FUN_BINDING_KEY_DISPATCH writes 1 immediately before its
// call to FUN_BINDING_COMMAND_EXECUTE and 0 immediately after. Override
// commands dispatched outside that engine path must mirror it so native
// command handlers observe the same manager state a real keypress produces.
// Verified in the FUN_BINDING_KEY_DISPATCH disassembly.
OFF_BINDING_MANAGER_EXECUTING = 0xD8,
// Frame-script execution context and its nesting depth (the `DAT_00ceeac0`
// dance referenced below). Shared by the binding dispatcher and the
// tooltip/frame script invokers. FUN_BINDING_KEY_DISPATCH saves the context
// pointer, zeroes it for the nested command, restores it afterward, and
// floors the depth back to 0. `Bindings::Api` mirrors this when it runs an
// override command outside the engine's own dispatch. Verified in that
// disassembly.
VAR_FRAMESCRIPT_EXEC_CONTEXT = 0x00CEEAC0,
VAR_FRAMESCRIPT_EXEC_CONTEXT_DEPTH = 0x00CEEAC4,
// The binding manager — 4.3.4's CGUIBindings, minus its modified clicks.
// `*VAR_BINDINGS_MANAGER`, a 0xDC-byte object made by FUN_004B6050 (FrameXML
// init FUN_0048FBF0) and destroyed by FUN_004B6100 (UI teardown
// FUN_00490BD0), so it is rebuilt on every world load and /reload. Binding
// sets as 4.3.4 numbers them: 0 default, 1 account, 2 character, 3 current;
// set N's table is at `mgr + 0x30 + N*0x28` (list head at +0x3C).
// OFF_BINDINGS_SAVE_SET (+0xD0) is m_saveSet (1 or 2, what
// GetCurrentBindingSet returns); +0xD4 the dirty-set mask.
VAR_BINDINGS_MANAGER = 0x00B71290,
OFF_BINDINGS_SAVE_SET = 0xD0,
BINDING_SET_DEFAULT = 0,
BINDING_SET_ACCOUNT = 1,
BINDING_SET_CHARACTER = 2,
BINDING_SET_CURRENT = 3,
BINDING_SET_COUNT = 4,
// CGUIBindings::Load — `int __thiscall(mgr, const char *path, MD5_CTX *md5,
// CStatus *status)`, `ret 0xC` (the caller at 0x00490006 loads ECX from
// VAR_BINDINGS_MANAGER; the prologue saves it); a null status means
// VAR_BINDINGS_LOAD_STATUS. Reads the file with FUN_FILE_READ, builds a tree
// with FUN_XML_TREE_LOAD and loads every root ``; any other node
// gets "Unknown node type %s in %s". Called for FrameXML's Bindings.xml
// (0x00490018) and for each addon's (FUN_0051F240).
// The status is used only through `Add` (vtable +0xC), with at most two
// string arguments after the format.
FUN_BINDINGS_LOAD_FILE = 0x004B6F70,
VAR_BINDINGS_LOAD_STATUS = 0x00B7124C,
STR_BINDINGS_UNKNOWN_NODE = 0x00846FB4, // "Unknown node type %s in %s" (file bytes)
// CGUIBindings::LoadBindings — `void __fastcall(int set, const char *text)`:
// clears the set, then binds every `bind KEY COMMAND` line. Sources:
// WTF\DefaultBindings.wtf into set 0 (FUN_004B62B0), then the account /
// character binding files into sets 1 / 2 (FUN_004B6240, which finishes
// with FUN_004B64B0 — 4.3.4's FinishLoadBindings).
FUN_BINDINGS_LOAD_SET = 0x004B6140,
// CGUIBindings::SaveBindings — `void __thiscall(mgr, int set, HANDLE file)`,
// `ret 8`: writes the set's `bind %s %s\r\n` lines through
// FUN_OS_WRITE_FILE. Called by the binding-file writer FUN_004B65B0.
FUN_BINDINGS_SAVE_SET = 0x004B6520,
// CGUIBindings::CopyBindings — `void __thiscall(mgr, int source, int dest)`,
// `ret 8`. Its gate FUN_00494A50(8) always passes (only actions 0, 2, 4,
// 10 and 11 are gated). Fires UPDATE_BINDINGS (0x182) when dest is current.
FUN_BINDINGS_COPY_SET = 0x004B6310,
// CGUIBindings::GetCommandAction for the current set — `const char
// *__thiscall(mgr, const char *key)`: the command bound to exactly `key`,
// or null. Script_GetBindingAction (FUN_SCRIPT_GET_BINDING_ACTION, which
// pushes "" for null) is its only Lua caller.
FUN_BINDINGS_GET_COMMAND_ACTION = 0x004B7DA0,
FUN_SCRIPT_GET_BINDING_ACTION = 0x004B8120,
// The manager's command table (4.3.4's m_commands), a Storm
// TSHashTable<_, HASHKEY_STRI> keyed by command name, filled from
// Bindings.xml. The engine inlines its lookup (FUN_BINDING_COMMAND_EXECUTE):
// hash = FUN_SSTR_HASH_HT(name); bucket = slots[hash & mask] (12 bytes:
// +0 link offset, +8 first node); a node is +0 hash, +0x14 name, and
// `*(node + linkOffset + 4)` is the next; a null or odd pointer ends the
// chain. Same layout as each binding set's key table (set N at
// `mgr + 0x30 + N*0x28`: slots +0xC4, mask +0xCC for set 3 in
// FUN_BINDINGS_GET_COMMAND_ACTION), so slots/mask are table +0x1C/+0x24.
// Verified in both disassemblies.
OFF_BINDINGS_COMMAND_TABLE = 0x08,
OFF_HASHTABLE_SLOTS = 0x1C,
OFF_HASHTABLE_MASK = 0x24,
OFF_HASHTABLE_NODE_NAME = 0x14,
// Storm SStrHashHT — `uint32_t __stdcall(const char *)` (callee pops its
// one argument; FUN_BINDINGS_GET_COMMAND_ACTION calls it with no cleanup).
// The case-insensitive string hash of HASHKEY_STRI tables.
FUN_SSTR_HASH_HT = 0x0064B3F0,
// CGGameUI::IsKeyDown for the merged modifiers — `int __fastcall(int
// which)`: 0 shift, 1 ctrl, 2 alt. IsShiftKeyDown / IsControlKeyDown /
// IsAltKeyDown (0x00488590..0x00488600) and the engine's own modifier
// reads (edit boxes, world clicks, mouse events, action use) call it.
// It is 4.3.4's EventIsKeyDown, taking any KEY code — 0..2 are 1.12's
// merged meta keys — and the console's key handler asks it whether the
// console toggle key is held.
// 4.3.4's version answers from the binding manager's held-modifier mask
// while a key binding runs; `Input::Modifier` co-hooks it to do the same.
FUN_GAMEUI_IS_KEY_DOWN = 0x0041F8F0,
// OsWriteFile — `int __fastcall(HANDLE /*ecx*/, const void *buffer /*edx*/,
// uint32_t size, uint32_t *written)`, `ret 8`.
FUN_OS_WRITE_FILE = 0x0042A5D0,
// " " — the token delimiter LoadBindings splits a `bind` line's key with.
VAR_STR_SPACE_DELIM = 0x0082EE00,
// GameTooltip script-method prologue helpers (used to resolve self → CFrameScriptObject*).
// Underlying Lua C API names per [[docs/LuaCAPI.md]] are `lua_rawgeti`
// (0x6F3BC0) and `lua_touserdata` (0x6F3740). The Set* method prologue's
// call sequence
// PushObject(L, idx, 0); // == lua_rawgeti(L, idx, 0) — pushes the
// // lightuserdata at table[0]
// GetObject(L, -1); // == lua_touserdata(L, -1) — extracts
// // the raw CFrameScriptObject *
// is the canonical "Lua frame table → C++ object" path. The reverse
// (`GameTooltip:GetOwner` etc.) is just `lua_rawgeti(L, REGISTRY,
// [cobj+OFF_COBJECT_LUA_REF])` — the engine pre-allocates
// the registry handle when the frame is created from Lua.
FUN_FRAMESCRIPT_PUSH_OBJECT = 0x6F3BC0,
FUN_FRAMESCRIPT_GET_OBJECT = 0x6F3740,
// Within a CGFrame, the embedded LayoutFrame sub-object starts here.
// Engine code that wants to invoke LayoutFrame methods polymorphically
// (anchoring, positioning) stores the LayoutFrame* — i.e.
// `(Frame*)obj + 0x24` — instead of the bare Frame*. Reverse
// lookups (e.g. GameTooltip:GetOwner) subtract this back out.
OFF_FRAME_LAYOUT_SUBOBJECT = 0x24,
// Inner spell-tooltip builder (CGTooltip::BuildSpell), called from
// Script_GameTooltip_SetSpell at 0x00532E92. `uint __thiscall(spellID,
// compact, cooldownMs, pet, showRank, talent, rebuild)`, RET 0x1C — the
// first six of 4.3.4's CGTooltip::SetSpell(spellId, brief, cooldown,
// isPet, showSubtext, …, talent, …, append, …) in order. `rebuild`
// skips the clear and the spellID stash (+0x39C) and, unlike 4.3.4's
// append, always heads the block with "\n" TOOLTIP_TALENT_NEXT_RANK
// instead of the name line (talent or not). A TRADESPELL record builds
// its created item's tooltip instead. Returns 1 when it added the
// cooldown line (cooldownMs != 0, recovery >= 60s) or a chance-to line.
FUN_GAMETOOLTIP_BUILD_SPELL_TOOLTIP = 0x0052E610,
// Existing GameTooltip method-table entries we dispatch to from
// backported convenience methods. Each is `int __fastcall(void *L)`
// expecting the standard self+args layout on the Lua stack.
// (Slot numbers are the method-registry index per `docs/raw_methods.txt`.)
// `SetText(text [, r, g, b, a, wrap])`: clear (FUN_GAMETOOLTIP_CLEAR), one
// line, then the has-text flag + Show vmethod — the exact sequence the
// engine's own macro branch (FUN_GAMETOOLTIP_SET_MACRO) runs, reachable
// through an entry point no sibling DLL has detoured. Pushes nothing.
FUN_SCRIPT_GAMETOOLTIP_SET_TEXT = 0x00531B90, // slot 9
// `SetOwner(frame [, anchor [, x [, y]]])` and `GetAnchorType()`: the engine's
// own methods (slots 4 and 5). SetOwner reads the anchor NAME from Lua
// argument 3 with a case-insensitive chain (see TOOLTIP_ANCHOR_*); GetAnchorType
// maps the stored code back, sending any code it does not know to
// "ANCHOR_NONE".
FUN_SCRIPT_GAMETOOLTIP_SET_OWNER = 0x005310D0,
FUN_SCRIPT_GAMETOOLTIP_GET_ANCHOR_TYPE = 0x005313E0,
// `SetHyperlink(link)`: type-gates self, then SStrCmpI-prefix-matches the
// argument against "item:" (id:enchant:suffix:unique ->
// FUN_GAMETOOLTIP_BUILD_ITEM) and "enchant:" (a spellID in
// VAR_SPELL_RECORDS whose record has `+0x0C == 3` ->
// FUN_GAMETOOLTIP_BUILD_SPELL_TOOLTIP), else raises "Unknown link type"
// (`0x00532269`). A full `|H...|h` link fails the prefix test. Co-hooked
// by `Tooltip::Hyperlink` for full links, `spell:` / `quest:`, and
// trade-skill `enchant:` links. SuperWoW patches a jump at `0x00532210`
// (after the `item:` test) that adds `quest:` and resumes at `enchant:`.
FUN_SCRIPT_GAMETOOLTIP_SET_HYPERLINK = 0x00531FD0, // slot 12
// `SetAction(slot)`: cooldown via FUN_ACTION_SLOT_COOLDOWN, clear, then
// attack → "ATTACK" text; item-by-ID → FUN_GAMETOOLTIP_BUILD_ITEM (owned
// instance via FUN_INVMGR_FIND_ITEM_BY_ID, else bare itemID); spell →
// FUN_GAMETOOLTIP_BUILD_SPELL_TOOLTIP(spellID, brief /*1 unless the
// UberTooltips cvar int is set*/, cooldownRemainingMs, 0, 1, 0, 0);
// macro → FUN_GAMETOOLTIP_SET_MACRO (name only). Pushes 1 when the
// builder returned non-zero (FrameXML keeps refreshing), else nil.
// `Tooltip::SetAction` re-registers the name in front of it for macro
// slots with a `#showtooltip` directive and tail-calls it otherwise.
FUN_SCRIPT_GAMETOOLTIP_SET_ACTION = 0x005322A0, // slot 13
FUN_SCRIPT_GAMETOOLTIP_SET_INVENTORY_ITEM = 0x00532EE0, // slot 19
FUN_SCRIPT_GAMETOOLTIP_SET_BAG_ITEM = 0x00534620, // slot 30 — (bag, slot)
// Macro-slot tooltip: `__thiscall(tooltip, uint macroID)` — clear +
// SetText(entry+OFF_MACRO_NAME) + Show. Internal, not a script entry.
FUN_GAMETOOLTIP_SET_MACRO = 0x0052B040,
// `Script_GameTooltip_SetUnit` (slot 31): self typecheck, lua_isstring(2),
// FUN_TOKEN_TO_GUID (raises on an unknown token), then — only for a
// non-zero GUID — FUN_GAMETOOLTIP_BUILD_UNIT. Always pushes nil (the
// builder returns 0 on every path). The token string is discarded after
// the resolve; `Unit::Tooltip` re-registers the name in front of it to
// keep the token for `GetUnit` and tail-calls it with the untouched stack.
FUN_SCRIPT_GAMETOOLTIP_SET_UNIT = 0x005349B0,
FUN_SCRIPT_GAMETOOLTIP_SET_UNIT_BUFF = 0x00534AC0, // slot 32
FUN_SCRIPT_GAMETOOLTIP_SET_UNIT_DEBUFF = 0x00534E30, // slot 33
FUN_SCRIPT_GAMETOOLTIP_SET_TALENT = 0x00535170, // slot 34
// Iterator that registers an array of frame-method bindings on a per-frame-type
// method registry (e.g. VAR_GAMETOOLTIP_METHOD_REGISTRY for GameTooltip).
// __fastcall(ecx = MethodEntry table, edx = count, [stack] = context).
FUN_REGISTER_FRAME_METHODS = 0x00701D80,
VAR_GAMETOOLTIP_METHOD_REGISTRY = 0x00C0CF20,
// CGameTooltip line pool. The engine caps AddLine (FUN_00530270) at
// `numLinesAllocated`, which the XML-OnLoad scan (FUN_00529650, vtable
// slot 9) sets to the count of contiguous `TextLeftN`/`TextRightN`
// FontStrings the template declares (30). Tooltip::LinePool grows it on
// demand inside AddLine, appending through FUN_GAMETOOLTIP_ADD_FONT_STRINGS.
// Each array is a {count@+0x0, cap@+0x4, data@+0x8} descriptor.
OFF_GAMETOOLTIP_NUM_LINES_ALLOC = 0x320, // int — pool size AddLine gates on
OFF_GAMETOOLTIP_TEXTLEFT_DESC = 0x324, // {count,cap,data}; data (+0x8) = CSimpleFontString*[]
OFF_GAMETOOLTIP_TEXTRIGHT_DESC = 0x330, // symmetric right column
OFF_GAMETOOLTIP_WRAPFLAG_DESC = 0x33C, // per-line wrap int[]
// __thiscall(tooltip, left, right), `ret 8` — the core of the
// `GameTooltip:AddFontStrings` method (0x00530C40): bumps
// numLinesAllocated, grows the three arrays to it, stores the pair and a
// 0 wrap flag in the new last slot. 4.3.4's CGTooltip::AddFontStrings.
FUN_GAMETOOLTIP_ADD_FONT_STRINGS = 0x00529940,
// GameTooltip:SetHyperlinkCompareItem (Tooltip::Compare) — builds the
// equipped item's tooltip natively (no Lua roundtrip) and appends
// colored stat deltas. FUN_GAMETOOLTIP_BUILD_ITEM is the engine's own
// item-tooltip builder that SetInventoryItem/SetHyperlink call:
// __thiscall(self, itemID, guid*, guid*, a4, a5, a6, headerFlag, a8, a9)
// Proven arg shape from FUN_005353b0/FUN_00535700 (all flags 0 → a clean
// item tooltip). The builder's own headerFlag (param_7) path merges the
// "Currently Equipped" text into the name line and force-wraps it, so we
// build clean (flag 0) and prepend the grey header ourselves by shifting
// the line FontStrings — see FUN_FONTSTRING_SET_* / OFF_FONTSTRING_*.
// FUN_GAMETOOLTIP_ADD_LINE is the raw add-line body (see LinePool notes);
// its color args are pointers to a 4-byte packed color {b,g,r,a} — the
// Lua AddLine handler (FUN_00531630) builds it as 0xFF, i.e.
// uint32 `0xFF000000 | r<<16 | g<<8 | b` in little-endian memory.
FUN_GAMETOOLTIP_BUILD_ITEM = 0x0052B650,
// OnTooltipSetItem support. FUN_GAMETOOLTIP_SCRIPT_RESOLVER is the
// CGGameTooltip vtable method (vtable 0x00808F60) that maps a script name
// to its handler slot; __thiscall(self, const char *name) -> int* slot,
// 0 if the name isn't a tooltip script. It first delegates to the base
// frame resolver, then checks OnTooltipSetDefaultAnchor(+0x444) /
// OnTooltipCleared(+0x44c) / OnTooltipAddMoney(+0x454) — each an 8-byte
// {handler, context} slot. Vanilla has no OnTooltipSetItem, and the object
// (alloc size 0x460) has no free 8-byte slot, so we co-hook this to hand
// out a C-side per-tooltip cell for that name. FUN_FRAME_INVOKE_SCRIPT is
// the engine's real script invoker __fastcall(handler /*ecx = slot[0]*/,
// frame /*edx*/): it binds the global `this` = frame and runs the handler
// under its own protected lua_pcall (0 args). We call it directly from the
// item-builder co-hook to fire OnTooltipSetItem.
// NOTE: the clear fires OnTooltipCleared via the wrapper FUN_00702690
// (self, &slot), which additionally stamps the global exec-context
// (DAT_00ceeac0) from slot[1]. That context mutation is only valid from
// the engine's top-level frame-script dispatch — firing it from deep in a
// nested Lua->C->Lua stack (e.g. an addon's SetAuctionItem wrapper)
// corrupts the outer script's context and faults. So we skip the wrapper
// and call the inner invoker, which is self-contained.
FUN_GAMETOOLTIP_SCRIPT_RESOLVER = 0x005295D0,
FUN_FRAME_INVOKE_SCRIPT = 0x00704D50,
// The arg-passing sibling of FUN_FRAME_INVOKE_SCRIPT — every frame
// script that carries values (OnClick(button), OnMouseWheel(delta),
// OnUpdate(elapsed), OnValueChanged(value), OnKeyDown(key), OnEvent's
// args, …) funnels through here. __cdecl(int handlerRef, void *frame,
// const char *fmt, void *vaPtr): fmt is a printf-style spec string
// (`%d`/`%u`/`%f`/`%s`), vaPtr points at the packed vararg buffer
// (4-byte stride for d/u/s, 8 for f). It sets the `arg1..argN` globals
// from the format (saving/restoring the previous values), sets the
// `this` global to `frame`, then runs the handler under a protected
// lua_pcall with **zero Lua args** and the engine error handler
// (VAR_FRAMESCRIPT_ERROR_HANDLER_REF) as errfunc. FUN_FRAME_INVOKE_SCRIPT
// is the same shape for the no-arg scripts (OnShow/OnHide/OnEnter/…).
// `Frame::ScriptArgs` co-hooks both to additionally pass the handler
// modern positional args (self, arg1..argN). The frame's own Lua object
// ref lives at frame+OFF_COBJECT_LUA_REF (refcount at
// OFF_COBJECT_LUA_REFCOUNT); FUN_FRAMESCRIPT_OBJECT_SCRIPT_REGISTER
// lazily creates it when the refcount is 0.
FUN_FRAME_RUN_SCRIPT_ARGS = 0x00704F10,
// The base ScriptObject's OnEvent handler slot — an 8-byte
// {handler, context} pair at frame+0x0C (from FUN_00702590, the base
// resolver every frame-type resolver chains through, and confirmed by
// the event dispatchers FUN_00703E50 / FUN_00703F50 passing `frame+0xC`
// as the slot). `*(int*)(frame + OFF_FRAME_ONEVENT_SLOT)` is the OnEvent
// handler ref; `Frame::ScriptArgs` compares it against the handler ref
// the runner is invoking to detect an OnEvent dispatch (exact — each
// SetScript makes a distinct ref, so a function bound to two scripts
// still differs per slot) and prepend the `event` positional.
OFF_FRAME_ONEVENT_SLOT = 0x0C,
// Registry ref (an int, not a pointer) to the frame-script message
// handler the engine passes as the `errfunc` to every script pcall —
// read as `*(int*)VAR_FRAMESCRIPT_ERROR_HANDLER_REF`, pushed via
// lua_rawgeti(REGISTRY, ref). Set once at engine init.
VAR_FRAMESCRIPT_ERROR_HANDLER_REF = 0x008722C8,
// The base Frame script-name resolver — __thiscall(frame, const char *name)
// -> int* slot, 0 for an unknown name. Maps the standard base-frame scripts
// to their 8-byte {handler, context} slots on the frame (OnLoad@+0x118,
// OnUpdate@+0x128, OnEnter@+0x140, … OnKeyUp@+0x190) after delegating to the
// ScriptObject base FUN_00702590 (OnEvent@+0xC). Every frame TYPE's resolver
// chains through this (the tooltip resolver above calls it first), so
// `Frame::ExtraScripts` co-hooks it to make the scripts 1.12 lacks
// (OnAttributeChanged, OnEnable, ...) SetScript/GetScript/HookScript-able:
// for those names the co-hook hands back an external per-frame cell. Same
// pattern + ABI modeling as FUN_GAMETOOLTIP_SCRIPT_RESOLVER.
FUN_FRAME_SCRIPT_RESOLVER = 0x0076A0D0,
// Button widget script-name resolver — __thiscall(button, const char *name)
// -> int* slot, 0 for an unknown name. Sits at vtable+0xC on all four
// button-family vtables (Button + subclasses). Delegates to the base frame
// resolver FUN_FRAME_SCRIPT_RESOLVER first, then maps the two button
// scripts: OnClick -> button+0x4CC, OnDoubleClick -> button+0x4D4 (each an
// 8-byte {handler, context} slot). Vanilla has no PreClick/PostClick, so
// `Frame::ClickEvents` co-hooks this to hand out an external per-button cell
// for those two names — same technique as FUN_GAMETOOLTIP_SCRIPT_RESOLVER.
FUN_BUTTON_SCRIPT_RESOLVER = 0x00778C50,
// Button OnClick / OnDoubleClick script slot offsets (the Button resolver's
// returns for those two names; each an 8-byte {handler ref, exec context}).
// `Frame::ClickEvents` matches a fire at the runner hook below against
// slotPtr == button + one of these to scope GetMouseButtonClicked.
OFF_BUTTON_ONCLICK_HANDLER = 0x4CC,
OFF_BUTTON_ONDOUBLECLICK_HANDLER = 0x4D4,
// CSimpleFrame script slots — the base-frame resolver FUN_0076A0D0's returns
// (it chains to CScriptObject FUN_00702590 first, OnEvent @ +0xC). Derived as
// one table, recorded as one: OnLoad +0x118, OnSizeChanged +0x120, OnUpdate
// +0x128, OnShow +0x130, OnHide +0x138, OnEnter +0x140, OnLeave +0x148,
// OnMouseDown +0x150, OnMouseUp +0x158, OnMouseWheel +0x160, OnDragStart
// +0x168, OnDragStop +0x170, OnReceiveDrag +0x178, OnChar +0x180, OnKeyDown
// +0x188, OnKeyUp +0x190. Only the two mouse-button slots are named:
// `Frame::ClickEvents` scopes GetMouseButtonClicked around their fires —
// the exact set 3.3.5's frame manager brackets (its CSimpleFrame::OnMouseDown
// FUN_0048fc30 and OnMouseUp FUN_0048fce0 write [frameMgr+0x1234]; its
// OnDragStart does not; confirmed live on 3.3.5, 2026-09-15). The dispatches
// are FUN_0076BF70 (mouse-down: records the drag candidate at +0xFC..+0x110,
// then fires) and FUN_0076C040 (mouse-up: dispatches OnDragStop/OnReceiveDrag
// instead when a drag was pending), each via FUN_FRAME_RUN_SCRIPT_VARIADIC
// (frame, frame + slot, "%s", name).
OFF_FRAME_ONMOUSEDOWN_SLOT = 0x150,
OFF_FRAME_ONMOUSEUP_SLOT = 0x158,
// The OnEnter / OnLeave slots. The frame's enter (0x0076B6A0) and leave
// (0x0076B6F0) fire them, when set, with FUN_FRAME_FIRE_SCRIPT (0x0076B6E5,
// 0x0076B753).
OFF_FRAME_ONENTER_SLOT = 0x140,
OFF_FRAME_ONLEAVE_SLOT = 0x148,
// The no-argument script fire: `void __thiscall(frame, int *slot)`, `ret 4`.
// It stamps the exec context from slot[1] and calls FUN_FRAME_INVOKE_SCRIPT
// with slot[0]. The caller tests slot[0] first.
FUN_FRAME_FIRE_SCRIPT = 0x00702690,
// CSimpleButton's cursor enter (vtable slot +0x4C, `__thiscall(button)`,
// `ret`) and leave (+0x50, `__thiscall(button, int removed)`, `ret 4`).
// For a button that is not disabled, they run the frame's enter/leave
// (0x0076B6A0 / 0x0076B6F0: companion frame, highlight, OnEnter/OnLeave)
// and the label refresh 0x00779810. Then they always notify the C++
// listener at +0x31C. Button 0x0081C7F8, CheckButton 0x0081CB80 and the
// vtable at 0x008045C0 hold them. The nameplate and hyperlink buttons
// have their own. Prologues 56 8B F1 8B 86 / 55 8B EC 56 8B F1: no
// relative branch, and no other client DLL names either address.
FUN_BUTTON_ON_ENTER = 0x00779490,
FUN_BUTTON_ON_LEAVE = 0x007794E0,
// CSimpleButton::SetText: `void __thiscall(button, const char *text)`,
// `ret 4`. Null text does nothing. With no label it creates one
// (0x00770D30(this, 2, 1)), then FUN_FONTSTRING_SET_TEXT(label, text, 1).
// Lua Button:SetText (0x00780D20) and 4.3.4's SetFormattedText call it.
FUN_BUTTON_SET_TEXT = 0x00778DC0,
// The button's label, a CSimpleFontString* (0 until SetText or SetFontString
// makes one); CSimpleButton::SetText writes its text (benilla-re ui/button).
OFF_BUTTON_LABEL = 0x338,
// Button::Click vmethod (Button vtable 0x0081C7F8 + 0x94) — __thiscall(button,
// buttonMask, fromScript), RET 8. Gate [+0x328] != 0 (enabled); runs the
// internal C++ click listener at +0x314 (vtable+0x10; set by FUN_00779740,
// never Lua-visible); iff [+0x4CC] is set, maps the mask through a jump
// table (targets @0x007795F4, index bytes @0x0077960C) to the engine's name
// literal and fires FUN_FRAME_RUN_SCRIPT_VARIADIC(button, button+0x4CC,
// "%s", name). Mask: 1 Left, 2 Middle, 4 Right, 8 Button4, 0x10 Button5,
// anything else "UNKNOWN". `fromScript` is 1 from Script_Click
// (FUN_007826C0 — folds its optional string to a mask: no arg -> 1,
// unrecognized or empty -> 0 -> "UNKNOWN") and 0 from both input handlers
// (mouse-down FUN_00779210 fires it for *Down registrations, mouse-up
// FUN_007792D0 for *Up, routing to +0x98 DoubleClick instead when [+0x4D4]
// is set and the previous click was <= 300 ms ago); the base ignores it.
// Every Lua-creatable button reaches this function: Button holds it in its
// vtable, CheckButton's override FUN_00785550 toggles +0x4DC then calls it;
// the nameplate button FUN_007CB910 and the game-UI button FUN_004C1820
// chain to it too. Only the hyperlink button FUN_007A3510 (vtable
// 0x0081D5B0) does not — it forwards to its owner's OnHyperlinkClick and
// never fires OnClick. `Frame::ClickEvents` co-hooks it to bracket EVERY
// click with PreClick/PostClick and the GetMouseButtonClicked scope, with
// or without an OnClick handler — the 3.3.5 shape (CSimpleButton::Click
// FUN_0096fd70 -> FUN_0096f090 fires PreClick, OnClick, PostClick as three
// independent `if (slot)` blocks).
//
// An earlier note here said SuperWoW inline-hooks this prologue and that a
// second MinHook faults (ERROR #132) — the reason PreClick/PostClick were
// first implemented at the runner and needed an OnClick handler to fire. A
// literal scan (2026-09-15) of every DLL the client loads — SuperWoWhook,
// nampower, perf_boost, pngscreenshots, regfix, transmogfix, UnitXP_SP3,
// VanillaHelpers, VanillaMultiMonitorFix, AuctionQueryThrottle,
// VanillaLooseLoader, VanillaMinimapTracking — finds NO reference to this
// address (absolute or RVA), while SuperWoWhook's real targets
// (SetEventCount, RebuildEventTable, SignalEventParam, ClearCastingSpell)
// all appear as plain literals, so the method would have found it. The #132
// sighting was real; this function was not its trigger. Prologue
// 55 8B EC 83 EC 14 56 8B CE — no relative branch in the first 6 bytes,
// internal jumps all target >= 0x7795B1: MinHook-safe.
FUN_BUTTON_CLICK = 0x00779540,
// Button::DoubleClick (vtable +0x98, shared by all five button-family
// vtables) — same shape, fires +0x4D4. NOT hooked: 3.3.5 fires no
// PreClick/PostClick around a double-click (FUN_0096f150 fires only
// OnDoubleClick), and its GetMouseButtonClicked scope comes from the runner
// gate on OFF_BUTTON_ONDOUBLECLICK_HANDLER. Reference only.
FUN_BUTTON_DOUBLECLICK = 0x00779650,
// Variadic front of the runner below — __cdecl(frame, slotPtr, fmt, ...),
// forwards &va as vaPtr to FUN_FRAME_RUN_SCRIPT_WITH_CONTEXT. The entry
// every input-script fire in the engine uses (25 call sites, byte-scanned).
// `Frame::ClickEvents` fires PreClick/PostClick through it so they take the
// identical path to the engine's own OnClick fire.
FUN_FRAME_RUN_SCRIPT_VARIADIC = 0x007026F0,
// The engine's "%s" format literal — the fmt every mouse-button script fire
// passes (OnClick, OnDoubleClick, OnMouseDown, OnMouseUp, OnDragStart) and
// the per-token unit-event broadcast uses. Passed by pointer so our fires
// are byte-identical to the engine's.
VAR_SCRIPT_FMT_S = 0x0082E280,
// The engine's button-name literals, exactly as FUN_BUTTON_CLICK's jump
// table selects them — so a PreClick/PostClick arg1 built from these is
// pointer-identical to the arg1 the engine hands OnClick.
VAR_BUTTON_NAME_LEFT = 0x00878864, // "LeftButton" mask 0x01
VAR_BUTTON_NAME_MIDDLE = 0x00878854, // "MiddleButton" mask 0x02
VAR_BUTTON_NAME_RIGHT = 0x00878848, // "RightButton" mask 0x04
VAR_BUTTON_NAME_4 = 0x00878840, // "Button4" mask 0x08
VAR_BUTTON_NAME_5 = 0x00878838, // "Button5" mask 0x10
VAR_BUTTON_NAME_UNKNOWN = 0x00838044, // "UNKNOWN" any other mask
// Frame-script runner WITH exec-context stamping — __cdecl(void *frame,
// int *slotPtr, const char *fmt, void *vaPtr). Saves DAT_00ceeac0, stamps
// it from slotPtr[1] (the cell's context), then calls FUN_FRAME_RUN_SCRIPT_ARGS
// (the arg'd runner Frame::ScriptArgs hooks) and restores. Every arg'd
// input-script fire funnels through here via FUN_007026F0 (its variadic
// forwarder); the event dispatcher FUN_00703F50 is the only other caller.
// ONE hook, owned by `Frame::RunnerHook`, fans out to subscribers that each
// claim a disjoint slot address (a second MinHook here would abort the
// whole install — subscribe instead): `Frame::ClickEvents` gates on the
// four mouse-button script slots (OnClick/OnDoubleClick on buttons,
// OnMouseDown/OnMouseUp on every frame) and scopes GetMouseButtonClicked
// around the fire — the runner is where the engine hands over the button
// NAME, so it is the scope point by design; `Frame::UnitEvent` gates on
// `slotPtr == frame + OFF_FRAME_ONEVENT_SLOT` (the dispatcher's per-frame
// OnEvent fire) and suppresses the call when a RegisterUnitEvent filter
// rejects arg1. PreClick/PostClick themselves fire from a co-hook on
// FUN_BUTTON_CLICK (see there — an earlier note here claimed SuperWoW
// owned that vmethod, which a per-DLL literal scan disproved).
FUN_FRAME_RUN_SCRIPT_WITH_CONTEXT = 0x00702710,
// The other per-object tooltip builders, co-hooked the same way as
// FUN_GAMETOOLTIP_BUILD_ITEM to back OnTooltipSetSpell / OnTooltipSetUnit /
// OnTooltipSetGameObject (see Tooltip::SetEvents). Each is the single funnel
// its Set*/mouseover paths converge on and clears the tooltip
// (FUN_00530050) before repopulating, so firing after it covers every way
// that object type gets set:
// - Spell FUN_GAMETOOLTIP_BUILD_SPELL_TOOLTIP (0x0052E610, 7 stack args,
// RET 0x1c) — SetSpell/SetSpellByID/SetTalent/SetShapeshift funnel.
// - Unit (0x00529fe0, __thiscall(self, guid*), RET 4) — SetUnit +
// the two engine mouseover paths (FUN_004919d0 / FUN_00492890).
// Returns an int the caller (Script_GameTooltip_SetUnit) tests, so the
// co-hook must forward the original's return value.
// - GameObject (0x0052aa20, __thiscall(self, guid*), RET 4) — the GO
// hover populator; resolves the GO (TYPEMASK_GAMEOBJECT) and writes the
// GO field at +0x370.
FUN_GAMETOOLTIP_BUILD_UNIT = 0x00529FE0,
FUN_GAMETOOLTIP_BUILD_GAMEOBJECT = 0x0052AA20,
// Pointer to the GameTooltip CFrameScriptObject the engine's mouseover
// setter builds into (`DAT_00b4b3c4`; the value at this address is the
// tooltip object). `Frame::Attributes` reads it to build the unit tooltip
// for offline/out-of-range party & raid members, which FUN_00492890 skips.
VAR_GAMETOOLTIP_OBJECT_PTR = 0x00B4B3C4,
// The tooltip's OnTooltipSetDefaultAnchor handler slot (the `{handler,
// context}` pair the script resolver maps that name to). The engine
// mouseover setter fires this before building to (re)establish the
// tooltip owner/anchor via FrameXML's GameTooltip_SetDefaultAnchor —
// without it a rebuild after the tooltip was hidden has no owner and
// stays invisible. `Frame::Attributes` fires it (via the self-contained
// FUN_FRAME_INVOKE_SCRIPT) before the offline roster build.
OFF_TOOLTIP_SET_DEFAULT_ANCHOR_HANDLER = 0x444,
FUN_GAMETOOLTIP_ADD_LINE = 0x00530270, // __thiscall(self, left, right, lColorBGRA*, rColorBGRA*, wrap)
OFF_GAMETOOLTIP_NUM_LINES = 0x31C, // int — live line count (AddLine index; +0x320 is the cap)
// The displayed item's identity is read via the existing
// OFF_TOOLTIP_ITEM_ID (+0x398) / OFF_TOOLTIP_ITEM_GUID_LO (+0x380) —
// link paths set the itemID, CGItem paths (SetInventoryItem/…) set only
// the GUID (see Tooltip::Compare::TooltipItemID and item/Tooltip.cpp).
// Line-shift primitives for prepending the grey "Currently Equipped"
// header. The per-line CSimpleFontString objects live in the parallel
// arrays at OFF_GAMETOOLTIP_TEXTLEFT/RIGHT_DESC (+8 = data). Each stores
// its text buffer pointer at +0xF0 and its 4-byte {b,g,r,a} color behind
// the pointer at +0xB8 (both verified from the setters below). We read a
// line's text/color and re-apply them one slot down, then set line 0.
// __thiscall(fs, text, expand), ret 8. expand = 1 (Lua SetText 0x0079D829,
// CSimpleButton::SetText) rewrites the |1 / |2 grammar escapes first.
FUN_FONTSTRING_SET_TEXT = 0x00771D80,
// The grammar pass, 4.3.4's LanguageProcess with only its rules 1 and 2:
// `char *__fastcall(text)`, returns the text or a static rewrite of it.
// Callers: AddChatLine 0x0049AF18, StartChatBubble 0x004B1611,
// FUN_FONTSTRING_SET_TEXT 0x00771D98 (expand = 1), UpdatePlate 0x006C703F.
FUN_EXPAND_GRAMMAR_ESCAPES = 0x007716F0,
// Its rules, `char *__thiscall(text)`, each output to the static
// 0x00CF1CC8 (0x1000 bytes): |1 Korean particles, |2 French articles.
FUN_EXPAND_KOREAN_PARTICLES = 0x00771770,
FUN_EXPAND_FRENCH_ARTICLES = 0x007719A0,
FUN_FONTSTRING_SET_COLOR = 0x0077F750, // __thiscall(region, colorBGRA*) — generic region color setter (fontstrings + textures)
// Generic region color GETTER — `void __thiscall(region, uint32* outBGRA)`,
// writes the packed {b,g,r,a} (0xFFFFFFFF when the region has no explicit
// color). The read half of Texture:GetVertexColor (FUN_0079aa50); paired
// with FUN_FONTSTRING_SET_COLOR above. Backs EditBox:GetHighlightColor.
FUN_REGION_GET_COLOR = 0x0077F8C0,
OFF_FONTSTRING_TEXT = 0xF0, // char* — current text buffer
// The fixed text size (XML `bytes`, 0 = none): SetText (FUN_FONTSTRING_SET_TEXT)
// copies with SStrCopy(text, src, n), which keeps n − 1 bytes; with 0 the
// buffer grows to any length (0x00771E0F / 0x00771E4D). 0x00771680 sets it.
OFF_FONTSTRING_FIXED_TEXT_SIZE = 0xE8,
OFF_FONTSTRING_COLOR_PTR = 0xB8, // ptr → 4-byte {b,g,r,a} color storage
// A line's FontString is only positioned once shown: set the desired
// flag at +0xC4 then call SHOW (FUN_0077fcb0) / HIDE (FUN_0077fc60) —
// the exact pair AddLine (FUN_00530270) and the clear use. Moving text
// into a previously-empty (hidden) cell without this leaves it
// unpositioned, so the line-shift must replicate it.
FUN_FONTSTRING_SHOW = 0x0077FCB0, // __fastcall(fs) — realizes +0xC4
FUN_FONTSTRING_HIDE = 0x0077FC60, // __fastcall(fs)
OFF_FONTSTRING_SHOWN_FLAG = 0xC4, // int — desired-shown flag
// The per-tooltip clear only HIDES line FontStrings (sets +0xC8 = 0)
// and clears the left text; right-column text buffers are left intact.
// So a shift must decide a cell's content by its actually-shown flag
// (+0xC8), not by whether +0xF0 still holds (stale) text.
OFF_FONTSTRING_VISIBLE = 0xC8, // int — actually-shown flag
// FontString creation primitives used by Tooltip::LinePool to build the
// extra lines entirely in C++ (no addon Lua). Calling conventions and
// offsets mirrored from Script_CreateFontString (0x00773C30),
// Script_SetFontObject (0x0079D1A0 → 0x00770C60), and Script_SetPoint
// (0x007A2540 → 0x00767C70) — see TODO #97's investigation update.
VAR_SIMPLEFONTSTRING_POOL = 0x00CF4D10, // CSimpleFontString free-list pool (allocator `this`)
VAR_SIMPLEFONTSTRING_CLASS_TAG = 0x00846544, // ".?AVCSimpleFontString@@" (alloc debug tag)
FUN_REGION_POOL_ALLOC = 0x00760450, // __thiscall(pool, zeroInit=0, tag, line=-2) -> raw mem
FUN_SIMPLEFONTSTRING_CTOR = 0x00770D30, // __thiscall(mem, parent, layer, sublayer) -> fs
FUN_REGION_SET_NAME = 0x0076C650, // __thiscall(region, name) — registers _G[name]
FUN_FONTSTRING_SET_FONT = 0x00770C60, // __thiscall(fs + OFF_FONTSTRING_FONT_HOLDER, fontObject)
// CSimpleFontString::SetFont — `uint32_t __thiscall(fs, const char *path,
// float height, uint32_t flags, uint8_t force)`, `ret 0x10` (0x007715F7):
// builds and installs the font unless unchanged; 0 when it fails. Script
// FontString:SetFont (0x0079D4F0) converts the height as
// Game::PixelToInternal does, parses the flags (FONT_FLAG_*), and on
// success clears bit 0 of OFF_FONTSTRING_FONT_FLAGS (benilla-re ui/fonttext).
FUN_SIMPLEFONTSTRING_SET_FONT = 0x007714F0,
// CSimpleFontString::SetAlphaGradient - `int __thiscall(fs, int start, int
// length)`, ret 8: stores the pair at +0x118 / +0x11C, rebuilding a built
// string. The constructor stores start -1 (no gradient) (benilla-re
// ui/fonttext; 0x00770D30).
FUN_FONTSTRING_SET_ALPHA_GRADIENT = 0x00772460,
OFF_FONTSTRING_FONT_FLAGS = 0xD4,
FONT_FLAG_OUTLINE = 1, // ParseFontFlags 0x006F1A90: OUTLINE 1, MONOCHROME 2, THICKOUTLINE 4
FUN_REGION_SET_POINT = 0x00767C70, // __thiscall(region+OFF_REGION_ANCHOR, point, relAnchor, relPoint, x, y, flag=1)
OFF_FONTSTRING_FONT_HOLDER = 0xCC, // font-reference sub-object (SetFont `this`)
OFF_FONTSTRING_FONT_OBJECT = 0xD0, // font object pointer (holder + 4)
OFF_REGION_ANCHOR = 0x24, // LayoutFrame anchor sub-object (SetPoint `this` / relativeTo base)
// --- GetPoint dangling-anchor guard (Frame::GetPointGuard) ---
// `Script_GetPoint` walks a region's 9 anchor-node slots at
// region+0x28. Each node with vtable VAR_ANCHOR_VTABLE_WITH_RELATIVE
// carries a RAW `relativeTo` pointer at +0x0C (the anchor target's
// LayoutFrame inner = target CFrame base + OFF_REGION_ANCHOR). When the
// target frame is freed the pointer is never cleared; GetPoint then does
// `MOV EAX,[relativeTo-0x24+4]` at 0x007A2452 → ERROR #132. The rel-less
// anchor node type (vtable 0x0081C42C, 12 bytes) has NO relativeTo field
// and its readers never deref one, so only 0x44C nodes can dangle.
FUN_GET_POINT = 0x007A2340, // engine Script_GetPoint (Region registry idx 15); Frame::GetPointGuard replaces it
FUN_REGION_CLEAR_POINT_BY_RELATIVE = 0x00767E70, // __thiscall(region+OFF_REGION_ANCHOR, relativeTo, doRelayout): frees+NULLs every anchor node on this region whose GetRelativeTo()==relativeTo (pointer compare, never derefs the target). The engine's own "my anchor target was removed" cleanup — the one NOT called on target destruction, which is the bug.
OFF_REGION_ANCHOR_ARRAY = 0x28, // region base + 0x28 = anchor-node slot[0] (= OFF_REGION_ANCHOR + 4)
REGION_ANCHOR_SLOT_COUNT = 9, // one slot per FRAMEPOINT_* enum (0..8)
OFF_ANCHOR_NODE_RELATIVE_TO = 0x0C, // raw relativeTo ptr within a 0x44C anchor node
VAR_ANCHOR_VTABLE_WITH_RELATIVE = 0x0081C44C, // .rdata vtable of anchor nodes that carry a relativeTo (vs rel-less 0x0081C42C)
// The rest of the relative anchor node (benilla-re ui/anchors "Absolute
// and relative points": {vtable, x, y, frame, point}, 0x14 bytes), and
// the getter Script_GetPoint (0x007A23F2) calls for the target instead
// of reading +0x0C: vtable+0x0C `void *__thiscall(node)` — the target's
// LayoutFrame inner (base = inner - OFF_REGION_ANCHOR), 0 for the
// rel-less node type. x and y are internal units (Game::InternalToPixel).
OFF_ANCHOR_NODE_X = 0x04,
OFF_ANCHOR_NODE_Y = 0x08,
OFF_ANCHOR_NODE_RELATIVE_POINT = 0x10,
VTBL_ANCHOR_NODE_GET_RELATIVE = 0x0C,
// The point names the XML loader and SetPoint share (benilla-re
// ui/anchors "Point slots and point names"), 4.3.4's StringToFramePoint /
// FramePointToString: `int __fastcall(const char *name, int *point)` (1 when
// known, case-insensitive) and `const char *__fastcall(int point)`
// ("UNKNOWN" for none).
FUN_STRING_TO_FRAME_POINT = 0x006F1840,
FUN_FRAME_POINT_TO_STRING = 0x006F1890,
DRAWLAYER_ARTWORK = 2,
DRAWLAYER_OVERLAY = 3,
FRAMEPOINT_TOPLEFT = 0,
FRAMEPOINT_TOP = 1,
FRAMEPOINT_TOPRIGHT = 2,
FRAMEPOINT_LEFT = 3,
FRAMEPOINT_CENTER = 4,
FRAMEPOINT_RIGHT = 5,
FRAMEPOINT_BOTTOMLEFT = 6,
FRAMEPOINT_BOTTOM = 7,
FRAMEPOINT_BOTTOMRIGHT = 8,
// FUN_REGION_SET_POINT stores offsets in *internal* coordinates, not
// pixels. Script_SetPoint converts: `internal = pixel * [0x00832A44] /
// ([0x00832A4C] * 1024)` (FUN_0041ae60's factor × input ÷
// (FUN_0041ad70's return × DAT_007ffd68)). Both globals are runtime
// UI-scale floats; passing raw pixels makes offsets ~1000× too large.
// The REVERSE conversion (internal → UI pixels) is what the Script_*
// measure getters push: Script_GetStringWidth (0x0079E510) — and our
// GetStringHeight backport — compute `px = internal * [0x00832A4C] *
// 1024 / [0x00832A44]` (FUN_0041AE40(FUN_0041AD70() × DAT_007FFD68 × v)).
//
// These four floats are the engine's Coordinate statics — the same block
// 3.3.5/4.3.4 keep as s_aspectRatio / s_ddcWidthScale / s_ddcHeightScale /
// s_aspectCompensation (Base/Coordinate.cpp in the 4.3.4 decomp; the 1.12
// image carries the identical static initializers 4/3, 0.8, 0.6, 1.0 at
// 0x00832A40). The anchor ("DDC", diagonal-normalized) space spans
// ddcWidthScale × ddcHeightScale across the screen, so the width scale IS
// the screen width in anchor units — the px→internal numerator above —
// and the height scale its Y sibling. Set together by the engine's
// CoordinateSetAspectRatio: comp = aspect × 0.75, s = 1/√(aspect²+1),
// height = s, width = aspect × s. Verified via the gxu text position
// converter FUN_0041ade0: block/node positions are stored NORMALIZED,
// x = anchor / width scale, y = anchor / height scale.
VAR_COORD_ASPECT_RATIO = 0x00832A40,
VAR_COORD_DDC_WIDTH_SCALE = 0x00832A44,
VAR_COORD_DDC_HEIGHT_SCALE = 0x00832A48,
VAR_COORD_ASPECT_COMPENSATION = 0x00832A4C,
UI_COORD_SCALE_UNIT = 1024, // DAT_007ffd68
// gxu text-raster dimensions — INT dwords holding the live render-target
// size in PIXELS ({0,0,640,480} fallback), written by FUN_005c2b50 from
// the render-target rect (FUN_0058a240) whenever it changes; every font
// page re-rasterizes on change (the FUN_005ca6f0 walk). These are the
// normalized→pen multipliers: the origin finalize FUN_005cdf70 computes
// node origin (+0x70/+0x74) = round(normalizedPos × [raster]) after
// folding the justify shift (right: +widthLimit, centre: +half) and
// vertical align; the emitter's font-height helper FUN_005C6FA0 is
// round(fontSize × [VAR_TEXT_RASTER_Y]) the same way (x sibling
// FUN_005C7010 uses _X). So TEXT PEN UNITS ARE RENDER-TARGET PIXELS, and
// pen-per-anchor = [VAR_TEXT_RASTER_*] / [VAR_COORD_DDC_*_SCALE] per
// axis — the exact conversion Text::InlineTexture's flush uses to place
// icon regions (verified against a live probe: rasterX/anchorW matched
// the measured origin÷rect-edge quotient to four digits).
VAR_TEXT_RASTER_Y = 0x00C2B9A0,
VAR_TEXT_RASTER_X = 0x00C2B9A4,
// GxCapsWindowSize — `__fastcall(float rect[4])`: the graphics device's
// live render-window rectangle (device vtable +0x5C), the source the
// two globals above are read from by GxuFontUpdateViewport
// (0x005C2B50). Layout {y0, x0, y1, x1}: width = r[3] - r[1], height =
// r[2] - r[0] — the font code's fallback writes {0, 0, 480, 640}, and
// BakePortrait takes its width from r[3] - r[1] of the sibling
// GxCapsScreenSize (0x0058A250).
FUN_GX_CAPS_WINDOW_SIZE = 0x0058A240,
// gxu text-node invalidate/reset — `__fastcall(node)`. Zeroes the
// built-line count (+0x9C, the draw builder's early-out gate), resets the
// link-rect state (+0x80/+0x90) and wrap cache (+0x68/+0x6C), and frees
// all 8 page buffers — the next paint's pre-pass re-runs the builder, so
// the emitter re-bakes the node from scratch. This is what the node
// colour setter FUN_005CCB40 calls on a colour change for accumulation
// (bit-3-clear) nodes; InlineTexture's flush calls it for a SEGMENTED
// bit-3 node whose BASE colour RGB changed (glue AddonList toggle), since
// baked per-glyph RGB can't be patched in place (|c runs own theirs).
FUN_TEXT_NODE_INVALIDATE = 0x005CDEF0,
// gxu font-face flags word. Bit 0 (0x1) = thin outline, bit 3 (0x8) =
// thick outline: the emitter's prologue (FUN_005CCBE0) reads
// *(fontFace+0x180) and grows the line height by [FLOAT_OUTLINE_EXTRA_*]
// pen px for outlined faces, because outline INK extends past the glyph
// metrics; the rebuild/color-sync shadow paths test the same bits. The
// inline-texture lead/trail pads read the same flags so an icon clears an
// outlined neighbour's ink (the coin-into-digits clip).
OFF_FONTFACE_FLAGS = 0x180,
// The engine's outline ink allowance, .rdata float constants (4.0 / 2.0
// pen px total, i.e. ~2 / ~1 px per side) — the exact values the emitter
// adds to line height for bit 3 / bit 0 outlined faces. Read live so we
// stay bit-identical with the engine's own compensation. The 2.0 constant
// double-duties as the MINIMUM font size numerator in the node ctor
// (FUN_005cd6d0 / FUN_005ccb80: fontSize floored at [0x801628]/rasterY =
// 2 pen px).
FLOAT_OUTLINE_EXTRA_THICK = 0x0080306C,
FLOAT_OUTLINE_EXTRA_THIN = 0x00801628,
// The node's BUILT line count — incremented once per emitted wrapped line
// by the draw builder (FUN_005CDC20, including the \n break case) and the
// builder's own early-out gate (`if (node+0x9C != 0) return`); zeroed by
// the node invalidate (FUN_TEXT_NODE_INVALIDATE). The render truth for
// FontString:GetNumLines once the node has painted.
OFF_TEXT_NODE_BUILT_LINES = 0x9C,
// Wrap break-array computer: `__thiscall(fs, const char *text, float
// wrapWidth /*fs-internal units*/, int *outBreaks, int cap)` → segment
// count (byte offsets into text, [0]=0). Routes through FUN_005C2430 →
// the wrap stepper, so it is icon-aware via the stepper co-hook. Verified
// from the GameTooltip auto-size (FUN_00530640), which fills a 20-entry
// array and measures each segment via FUN_FONTSTRING_MEASURE_SUBSTRING.
// Prologue 55 8B EC 56 8B F1, RET 0x10. Co-hooked by Text::InlineTexture
// to give the wrap stepper the fontstring's layout scale.
FUN_FONTSTRING_BREAK_ARRAY = 0x00772B60,
// Substring width measure: `__thiscall(fs, const char *text, int len)` →
// ST0 (len 0 = strlen). Same measure-core call + `out / fs+0x7C` shape as
// GetStringWidthInternal, but for an ARBITRARY string in the fs's font —
// no cache. Callers (xrefs): the GameTooltip auto-size FUN_00530640, which
// measures each WRAPPED SEGMENT of a wrap-enabled line between the
// FUN_00772B60 break positions and takes the max as the tooltip width —
// the icon-relevant consumer (an earlier note claimed nothing consumed
// this function; the xref list refutes it) — plus the editbox
// caret/selection cluster (FUN_0077DA80, FUN_0077DE70, FUN_0077D0D0).
FUN_FONTSTRING_MEASURE_SUBSTRING = 0x00772AE0,
// Fit-to-width: `int __thiscall(fs, const char *text, uint32_t bytes,
// float width)` → how many characters of `text` fit `width` (fs units;
// bytes 0 = strlen), RET 0xC. Calls FUN_0044d860 → GxuFontGetMaxChars-
// WithinWidth (0x5c2190 → 0x5c6c50) and returns its EAX count (benilla
// names it MeasureText and types it float — the disassembly returns the
// kernel's int). Callers (xrefs): CSimpleEditBox::RebuildLabel 0x77d71a
// (the single-line visible window), MeasureWindow 0x77d38a and
// GetIndexAtPoint 0x77d2e0 (mouse → cursor). Co-hooked by
// Text::InlineTexture so icons take their width.
FUN_FONTSTRING_FIT_TEXT = 0x00772BC0,
// FontString → gxu face resolution, for fs-level (measure-hook) callers
// that need the face the RENDER will use. The rebuild (FUN_007724a0)
// passes [fs+0xE0] (the font HANDLE) to the block creator FUN_0044d420,
// which hands [handle+0x20] to FUN_005c1c30 → FUN_005cd6d0, which stores
// it at node+0x44 — the emitter's face (`this` for every glyph call, and
// the +0x180 outline-flags carrier). So face = [[fs+0xE0]+0x20].
OFF_FONTSTRING_FONT_HANDLE = 0xE0,
OFF_FONT_HANDLE_FACE = 0x20,
// CSimpleTexture (`Texture` widget) creation + operate primitives, used by
// Text::InlineTexturePool to render inline |T icons as engine-owned,
// managed-pool, resident-kept textures (the residency fix — see
// docs/InlineTextureResidency.md). Mirrors Script_CreateTexture
// (FUN_00773A20) and the Texture frame-method handlers; the sibling of the
// CSimpleFontString path above. Same FUN_REGION_POOL_ALLOC / SetPoint /
// Show / Hide / SetColor (FUN_FONTSTRING_SET_COLOR) as the FontString pool.
VAR_SIMPLETEXTURE_POOL = 0x00CF4CE0, // &DAT_00cf4ce0 CSimpleTexture free-list pool (`this`)
VAR_SIMPLETEXTURE_CLASS_TAG = 0x00846588, // ".?AVCSimpleTexture@@" (alloc debug tag)
FUN_SIMPLETEXTURE_CTOR = 0x0076FC40, // __thiscall(mem, parent, layer, sublayer) -> tex
// --- MaskTexture object API (frame:CreateMaskTexture / Texture:AddMaskTexture) ---
// CreateMaskTexture mints its mask region by calling the engine's own
// Script_CreateTexture (reads (frame,name,layer,template) off the Lua stack and
// pushes the new CSimpleTexture), then hides it — the mask is a source, never drawn.
// The draw hook reads the mask's HTEXTURE (OFF_SIMPLETEXTURE_HTEXTURE, +0xCC, set
// by SetTexture and valid while hidden) + its rect (FUN_REGION_GET_RECT); the
// +0xC4 shown flag is OFF_REGION_DESIRED_SHOWN (defined below).
FUN_SCRIPT_CREATE_TEXTURE = 0x00773A20, // Script frame:CreateTexture, __fastcall(L)->int
// CSimpleTexture::SetTexture(path). Loads via FUN_00449D90, stores the owned
// HTEXTURE at +0xCC (releases the old via DecRef FUN_0041AED0), marks dirty.
// `__thiscall(tex, path, 0, *VAR_TEXTURE_BLEND_DEFAULT, 0) -> u32`. The
// ownership + engine batched region-draw is the residency win. Same-path
// early-out makes pooled reuse cheap.
FUN_SIMPLETEXTURE_SET_TEXTURE = 0x00770200,
// Script_Texture_SetTexture — the Lua `texture:SetTexture(...)` handler. Its
// NUMERIC branch (arg 2 a number) clamps r/g/b/a to [0,1] and fills the
// texture with a solid colour via FUN_00770360; its string branch loads a
// path through FUN_00770200 above. texture/ColorTexture.cpp aliases this whole
// handler as the 7.0 `SetColorTexture` (which IS exactly the numeric form), so
// the clamp and opaque-alpha default come straight from the engine.
FUN_SCRIPT_TEXTURE_SET_TEXTURE = 0x0079BB40,
// Script_Texture_SetTexCoord — the Lua `texture:SetTexCoord(...)` handler
// (entry 17 of the Texture method batch at 0x0087C128). Takes the 4-arg
// (left, right, top, bottom) and 8-arg corner forms and writes through to
// FUN_SIMPLETEXTURE_SET_TEXCOORD below. texture/Atlas.cpp delegates to this
// handler rather than the native setter so an atlas set inherits the engine's
// own arg validation and both coordinate forms.
FUN_SCRIPT_TEXTURE_SET_TEXCOORD = 0x0079BEB0,
// `texture:GetTexCoord()` (entry 16 of the same batch). Always returns 8
// values — four (x, y) corner pairs read from region +0x104 in the order
// UL, LL, UR, LR. texture/Atlas.cpp co-hooks both this and the setter so an
// atlas'd texture's coordinates address the sprite rather than the file it
// sits in; the pair is the only place that mapping is applied.
FUN_SCRIPT_TEXTURE_GET_TEXCOORD = 0x0079BDF0,
// CSimpleTexture::SetTexCoord — `__thiscall(tex, float[4])`. Struct field
// order is {top, left, bottom, right} = {v0, u0, v1, u1} (verified from the
// SetTexCoord handler 0x0079BEB0's Lua-arg → struct mapping). Natural
// texcoords (no v-flip — the engine region path is top-left origin).
FUN_SIMPLETEXTURE_SET_TEXCOORD = 0x00770410,
OFF_SIMPLETEXTURE_HTEXTURE = 0xCC, // owned HTEXTURE ref (diagnostic)
// The four drawn-quad corner POSITIONS: 4 vertices of {x, y, z} floats (0xC
// stride), order BL, TL, BR, TR (from FUN_REGION_STORE_CORNERS's writes). The
// region draw enqueue FUN_00772fd0 (0x00772fd0) hands region+0xD4 straight to
// the vertex batch as FOUR INDEPENDENT vertices — and region+0x104 as the
// matching 4 per-corner texcoords — never re-deriving an axis-aligned rect.
// So writing ROTATED x,y here draws a rotated quad with NO corner clipping
// (unlike 4.3.4's SetRotation, which rotates the texcoords instead). Used by
// texture/Rotation.cpp for Texture:SetRotation.
OFF_SIMPLETEXTURE_CORNERS = 0xD4,
// Region corner-store: `__thiscall(region, const float rect[4])` writes the
// drawn quad corners into region+0xD4..+0x100 from the rect ({yA,left,yB,right}
// screen px). The renderer only draws a region whose +0xD4 corners are
// populated (verified: the draw gate tests region+0xD4 != 0), and normally
// SetPoint→layout-resolve calls this. We call it directly to place an icon by
// its screen rect with NO anchors (anchoring 100+ textures/frame corrupts the
// UI-manager pending-layout list — the FUN_00765650 crash). Co-hooked by
// texture/Rotation.cpp, which re-applies rotation right after the engine
// restores the axis-aligned corners (layout resolve / SetTexCoord).
FUN_REGION_STORE_CORNERS = 0x007705B0,
// CSimpleTexture::OnFrameSizeChanged — `__thiscall(texture+OFF_REGION_ANCHOR,
// const float *oldRect)`, the layout callback: lays out dependents, then
// writes the corners from the new rect (cropped when +0x124 is set) with
// FUN_REGION_STORE_CORNERS. 4.3.4's CSimpleTexture::OnFrameSizeChanged
// (0x004F8E30), less its playing-animation leg, which Animation::Region
// adds back with a co-hook. Verified by decompile (benilla-re regions.md).
FUN_TEXTURE_ON_FRAME_SIZE_CHANGED = 0x00770670,
// Texcoord crop applied to a {top,left,bottom,right} screen rect before the
// corner-store: shrinks right→left and bottom→top by the region's per-corner
// texcoord span (ABS of the +0x104 U/V differences). No-op for full 0..1
// texcoords. `__thiscall(region, float rect[4])`, rect in/out. The crop
// itself is unconditional; every engine call site gates it on
// OFF_REGION_TEXCOORD_MODIFIES_RECT below — with the flag clear (the
// default) a partial SetTexCoord draws at the region's FULL size, so
// callers replicating an engine store must apply the same gate.
FUN_REGION_TEXCOORD_CROP = 0x00770570,
// The SetTexCoordModifiesRect flag (int). Written from the Lua boolean by
// Script_SetTexCoordModifiesRect (0x0079C080, `piVar4[0x49]`), read back
// 1/nil by Script_GetTexCoordModifiesRect (0x0079C120). All three
// FUN_REGION_TEXCOORD_CROP call sites test it: the SetTexCoord writers
// (FUN_00770410 4-arg, FUN_007704C0 8-arg corner form) crop+store only
// when set, and the layout-resolve store path (FUN_00770670) crops when
// set / stores the raw anchor rect (+0x40..+0x4C) when clear. Zero by
// default (region ctor), so the crop never runs unless an addon opts in.
OFF_REGION_TEXCOORD_MODIFIES_RECT = 0x124,
// The region's pixel-shader slot (CGxShader*, 0 = fixed-function). This IS
// the engine's desaturation state: Script_SetDesaturated (0x0079C1E0)
// stores the UI Desaturate shader here via FUN_SIMPLETEXTURE_SET_SHADER,
// Script_IsDesaturated (0x0079C2C0) tests it != 0, the batch append
// FUN_00772FD0 copies it into the layer entry (+0x18), and the layer draw
// FUN_0076FB00 binds it per region with GxRs selector GXRS_PIXEL_SHADER.
// The region ctor FUN_0076FC40 zeroes it. texture/Desaturation.cpp selects
// its per-level shader objects through this slot — see the "Texture
// desaturation" block.
OFF_SIMPLETEXTURE_SHADER = 0x128,
// Get the region's resolved screen rect: `__thiscall(region+OFF_REGION_ANCHOR,
// float out[4]) -> int` (1 = valid, 0 = not laid out yet). Reads the anchor
// sub-object's +0x40..+0x4C = {bottom, left, top, right} — 4.3.4's
// CLayoutFrame::GetRect and its CRect {minY, minX, maxY, maxX}, in DDC
// (Script_GetBottom 0x007A1CE0 reads out[0], Script_GetTop 0x007A1BC0
// out[2]) — gated on the rect-valid bit [+0x3c]&1. This is the engine's own source for the corner
// rect (see FUN_00770410's SetTexCoord path); texture/Rotation.cpp reads it to
// rebuild axis-aligned corners before rotating.
FUN_REGION_GET_RECT = 0x00768320,
// __thiscall(region+OFF_REGION_ANCHOR) -> int (nonzero = layout dirty, needs a
// resolve). GetLeft gates its resolve on this. Paired with the flag-1 resolve
// below to read a hidden region's rect synchronously.
FUN_REGION_LAYOUT_DIRTY = 0x00768310,
// __thiscall(region+OFF_REGION_ANCHOR, int flag /*stack; pass 0*/) — force a
// synchronous layout resolve: recomputes the region's rect (+0x64) from its
// anchors right now, instead of waiting for the render's pending-layout pass.
// Verified from Show (FUN_0077FCB0 at 0x0077FCE1: PUSH 0; LEA ECX,[ESI+0x24];
// CALL). Load-bearing for tick-time icon placement: SetTexCoord
// (FUN_00770410) stores the DRAW CORNERS (+0xD4) from the rect as a side
// effect, so without a realize between SetPoint and SetTexCoord the corners
// are stored from the STALE pre-anchor rect — the region's rect then resolves
// correctly (diagnostics look perfect) but the renderer draws the corners,
// which stay zero/stale → invisible icons (and the old build's frozen
// top-left icons: corners stored from the zero rect at first apply).
FUN_REGION_LAYOUT_REALIZE = 0x00768060,
// CSimpleFontString::RebuildString — destroys the old gxu text node and
// creates the fresh one (FUN_0044d420), storing it at fs+0xF8. Gated on the
// fs dirty bit (+0x60 & 1), so it fires on TEXT CHANGES, not per frame.
// Co-hooked by Text::InlineTexture to map text node → owning fontstring —
// the key that lets inline-icon regions anchor to their owning line
// (1.12 chat lines ARE CSimpleFontStrings: the ScrollingMessageFrame's
// display refresh FUN_00788750 SetTexts/anchors/shows one fs per visible
// line — verified against the 4.3.4 CSimpleEmbeddedTexture model, which
// anchors its icon regions to the owning fontstring the same way).
FUN_FONTSTRING_REBUILD_STRING = 0x007724A0,
// fs+0xF8 holds an HTEXTBLOCK handle, NOT the node itself: FUN_0044d420
// allocates the 12-byte handle {vtbl, refcount, node}, FUN_005c1c30 writes
// the created text node into handle+8, and FUN_0041af10 AddRefs and returns
// the handle. The layout's node (what the emitter/paint hooks see) is
// therefore *( *(fs+0xF8) + 8 ).
OFF_FONTSTRING_TEXT_BLOCK = 0xF8, // HTEXTBLOCK handle (0 when dirty/empty)
// CSimpleFontString live text color: count at +0xB4, array pointer at +0xB8
// (uint32 BGRA per slot; slot 0 = the base color, alpha = byte 3; a parallel
// per-glyph alpha-byte array hangs off +0xA8/+0xA4). Written by the fs
// SetColor (FUN_FONTSTRING_SET_COLOR 0x0077F750: stores the dword at
// (*(u32**)(fs+0xB8))[0] + the alpha byte at (*(u8**)(fs+0xA8))[0], then
// fires the color-update vmethod +0x20). Count 0 = never colored = default
// opaque white. THE CHAT-FADE SIGNAL: the ScrollingMessageFrame's fader
// (FUN_00788460, gated on the SetFading flag at smf+0x360; per-line state
// {rgba@+4, shown@+8, timeVisibleLeft@+0xC, fadeLeft@+0x10} in the
// stride-0x10 line array at smf+0x3A4) animates each visible line
// fontstring's alpha byte through this same SetColor every frame, then
// hides the fs at fade end. Text::InlineTexturePool mirrors this byte onto
// the line's icon regions each tick so inline icons fade with their line
// (regions parent to the CHAT FRAME, so the frame's own alpha byte —
// frame+0xC8, per Script_GetAlpha 0x00774DC0 — already modulates them via
// the engine's parent×region product; only the fs's own component needs
// mirroring).
OFF_FONTSTRING_COLOR_COUNT = 0xB4,
OFF_FONTSTRING_COLOR_ARRAY = 0xB8,
OFF_TEXTBLOCK_NODE = 0x8, // the gxu text node inside the handle
// Byte of fontstring state flags; bit 1 = "text block needs rebuild".
// RebuildString (0x7724A0) gates on it at entry, releases the old block
// (+0xF8 = 0), and only CREATES a new one if the fs rect is resolved —
// a SetText during an unresolved rect leaves the fs blockless with the
// refcounted zombie node still painting. If the bit is also clear at that
// point, nothing ever rebuilds (the stuck-blockless state InlineTexture's
// flush nudges by re-setting this bit).
OFF_FONTSTRING_DIRTY_FLAGS = 0x60,
// The per-node draw builder: walks a node's wrapped lines and calls the
// glyph emitter (FUN_TEXT_EMITTER) once per line. Called from the paint's
// per-node pre-pass FUN_005cd6a0 (`__thiscall(node)`, no stack args). We
// co-hook it to stamp exact BUILD BOUNDARIES for the emitter's first-line
// detection — the old `text == node+text-ptr` heuristic silently failed on
// pfUI-processed chat lines (stale/preprocessed pointer), leaving inherited
// records on reused node addresses (ghost icons) or never clearing them.
FUN_TEXT_DRAW_BUILDER = 0x005CDC20,
// The gxu text-node FREE: unlinks the node from its layout lists and pushes
// it onto the node free list (DAT_00c2b98c) for reuse. Single caller —
// FUN_005c1d00, the HTEXTBLOCK handle release (handle vtbl 0x008026e4 dtor
// 0x0044D5C0 → 0x005c1d00 → here). This is the choke point where every
// text node dies and its address becomes reusable: InlineTexture hooks it
// to erase ALL per-node state exactly at death, making stale-record and
// stale-owner bugs (ghost icons, orphaned records) structurally impossible
// instead of heuristically guarded.
FUN_TEXT_NODE_FREE = 0x005CD950,
// Ensure a text node is laid out: `__fastcall(node)` -> FUN_005cd3f0 + the
// draw builder FUN_005CDC20 (runs the glyph emitter and finalizes the node
// origin +0x70/+0x74), then clears node+0xc0. Same "ensure built" the paint
// pass (FUN_005c8fe0) calls per node; safe to call directly (the builder
// re-lays the node — a clean node just re-emits the same glyphs). Verified
// callers: the paint pass and FUN_005cd4d0 (the width/resize helper).
// Text::InlineTexture drives it PRE-RENDER from the SMF-refresh early-apply
// so a chat line's icons are recorded before the frame draws.
FUN_TEXT_ENSURE_BUILT = 0x005CD6A0,
// CScrollingMessageFrame display refresh — `__thiscall(smf, int newestIdx)`.
// Rebuilds the visible line set bottom-up: per slot it SetTexts the line
// fontstring (FUN_00788af0 -> SetText FUN_00771d80 + enqueue-resolve
// FUN_007680e0 flag 1), (re)anchors newly-allocated lines, shows/hides by
// message. Every new message shifts the newest index, so EVERY visible slot
// is re-SetText'd -> its inline icons must be recomputed; the engine builds
// the line lazily at paint, so icons land one frame after the glyphs (the
// one-frame lag). ScrollingMessageFrame::Layout owns the hook and fans
// out after it; Text::InlineTexture listens and, post-refresh,
// forces each icon-bearing line to resolve+build and applies its icon
// placement synchronously — pre-render (the refresh runs from the SMF's
// Lua/event-driven methods, never mid-render), so icons draw with their
// glyphs the same frame. Line-entry layout verified from the decompile:
// count@+0x3A0, stride-0x10 entry array@+0x3A4, entry+8 = the line fs.
FUN_SMF_DISPLAY_REFRESH = 0x00788750,
OFF_SMF_LINE_COUNT = 0x3A0, // int: allocated visible-line count
OFF_SMF_LINE_ARRAY = 0x3A4, // base of the stride-0x10 line-entry array
SMF_LINE_STRIDE = 0x10, // per-line-entry stride
OFF_SMF_LINE_FONTSTRING = 0x8, // entry+8 = the line's CSimpleFontString
// THE pen↔anchor unit bridge. RebuildString (0x7724A0) multiplies every
// text-unit quantity by region+0x7C when crossing into node creation:
// nodePos = inset×s + rect corner, nodeFontH = fontPx×s, spacing = +0xF4×s,
// and divides rect extents by s for the text-unit width/height. SetParent
// (FUN_0076AB10) propagates the parent's +0x7C down the frame tree — it's
// the per-object layout/UI-scale chain. This single scalar is what every
// earlier "derive the scale" attempt (13/16, ownerH/fontH) was guessing at.
OFF_LAYOUT_SCALE = 0x7C, // float: anchor units per text/pen unit
OFF_FONTSTRING_INSET_X = 0x110, // float, text units (RebuildString posX term)
OFF_FONTSTRING_INSET_Y = 0x114, // float, text units (RebuildString posY term)
// CSimpleFontString::OnFrameSizeChanged — `__thiscall(fs+OFF_REGION_ANCHOR,
// const float *oldRect)`: rebuilds the string when the rect's size changed,
// else moves it to inset × OFF_LAYOUT_SCALE + the rect's min corner
// (rect[1] x, rect[0] y) with FUN_TEXTBLOCK_SET_STRING_POS. 4.3.4's
// CSimpleFontString::OnFrameSizeChanged (0x004FE350), less its
// playing-animation leg, which Animation::Region adds back with a co-hook.
// Verified by decompile.
FUN_FONTSTRING_ON_FRAME_SIZE_CHANGED = 0x00772D40,
// TextBlockSetStringPos — `void __fastcall(HTEXTBLOCK, const float pos[3])`:
// divides the DDC x/y by the screen scale (UnscaleScreenXY 0x0041ADE0) and
// stores them with GxuStringSetPosition (0x005C2770 → CGxString::SetPosition
// 0x005CCB10, which writes OFF_TEXT_NODE_POSITION and refinalizes the
// origin). The call SetTextOffset (0x00772100) and OnFrameSizeChanged use.
FUN_TEXTBLOCK_SET_STRING_POS = 0x0044D600,
// CSimpleRegion::SetParentAndLayer — __thiscall(region, parentFrame, layer,
// show). Handles old-parent unlink + new-parent region-registry insert +
// conditional Show. Verified from the region base ctor FUN_0077F640 and the
// message frame's per-line setup (FUN_00788750 calls it with (frame, 2, 1)).
FUN_REGION_SET_PARENT_AND_LAYER = 0x0077FD10,
OFF_REGION_PARENT = 0x9C, // region's parent frame ptr (read by Show's gates)
OFF_REGION_DESIRED_SHOWN = 0xC4, // Show (FUN_0077FCB0) NO-OPS unless this is set;
// engine callers always write it before show/hide
OFF_REGION_ACTUALLY_SHOWN = 0xC8, // 1 after Show completed (the realize latch)
// The level draw (benilla-re ui/draworder). CSimpleTop's render pass
// (0x007657D0) walks strata 0..8 and each stratum's levels ascending; per
// level it rebuilds the dirty layers, then draws the level's batches.
// - FUN_FRAME_DRAWLIST_REBUILD — CFrameStrataNode::RebuildBatches,
// `int __fastcall(levelNode)`. For each layer bit set in the node's
// dirty mask (+0x10C) it begins the layer's batch (node+0x1C+0x30*layer)
// with FUN_RENDERBATCH_BEGIN, asks every frame of the level without
// FRAME_FLAG_SCROLLED for its regions of that layer through vtable+0x44
// (CALL_FRAME_LEVEL_EMIT_LAYER), sorts it with FUN_RENDERBATCH_SORT, and
// links every batch whose entry count is nonzero into the level's draw
// list in layer order.
// - FUN_FRAME_LAYER_RENDER — DrawBatch, `void __fastcall(batch)`: the
// batch's quads (sorted by texture), then its text sub-batch, then each
// render callback, `fn` called as `__thiscall(arg)`.
FUN_FRAME_DRAWLIST_REBUILD = 0x00765920,
FUN_FRAME_LAYER_RENDER = 0x0076FB00,
FRAME_LAYER_COUNT = 5, // BACKGROUND, BORDER, ARTWORK, OVERLAY, HIGHLIGHT
// The rebuild's per-frame call: `mov eax,[ebx]; push ecx; push esi; mov
// ecx,ebx; call [eax+0x44]` (8B 03 51 56 8B CB FF 50 44, 9 bytes), with the
// frame in ebx, the level's layer batch in esi and the layer in ecx.
CALL_FRAME_LEVEL_EMIT_LAYER = 0x007659E7,
// A frame that draws itself (FRAME_FLAG_SCROLLED) draws through vtable+0x40
// (CSimpleFrame's 0x0076B3F0): its own five batches, then each shown child
// without FRAME_FLAG_SCROLL_CHILD through the child's +0x40, at 0x0076B511:
// `mov edx,[ecx]; call [edx+0x40]` (8B 11 FF 52 40), the child in ecx.
VTBL_FRAME_DRAW_SELF = 0x40,
CALL_FRAME_DRAW_SELF_CHILD = 0x0076B511,
// Layer batch operations, each `__thiscall(batch)`, plain `ret`: the
// in-place constructor (stores vtable 0x0081C7AC, empties every list), the
// destructor (begins it, then frees the quad array), begin (zeroes the
// quad count and the entry count, frees the text sub-batch, frees every
// callback node) and the texture sort (qsort of the quads by handle).
FUN_RENDERBATCH_CONSTRUCT = 0x00772E80,
FUN_RENDERBATCH_DESTRUCT = 0x00772EF0,
FUN_RENDERBATCH_BEGIN = 0x007731D0,
FUN_RENDERBATCH_SORT = 0x007731A0,
RENDERBATCH_SIZE = 0x30,
// Adds a render callback — `void __thiscall(batch, fn, arg)`, `ret 8`: a
// 0x10-byte node with `fn` at +0x08 and `arg` at +0x0C, linked into the
// list whose first node is at OFF_RENDERBATCH_CALLBACKS (node+0x04 next,
// NULL or low bit 1 ends it), counted in OFF_RENDERBATCH_ENTRY_COUNT so the
// level links the batch even with no quads. The ScrollFrame's layer emit
// (0x007871C0) adds its scroll child's draw (0x00787220) to its HIGHLIGHT
// batch this way.
FUN_RENDERBATCH_ADD_CALLBACK = 0x00773110,
OFF_RENDERBATCH_CALLBACKS = 0x24,
// Resolved on-screen rect of a region: 4 floats at regionBase+0x64 (=
// LayoutFrame+0x40), in GxU SCREEN PIXELS — verified: FUN_00770670 reads
// them and FUN_007705b0 stores them straight as GxU vertex corners. Layout is
// {yA, left, yB, right} (x at [1]/[3], y at [0]/[2]); use min/max to get
// left/top without pinning which y index is top.
OFF_REGION_RECT = 0x64,
// "Currently displayed thing" state fields on a GameTooltip frame
// instance. Each Set* path writes one of these (and zero or two
// others), and the per-tooltip Clear at FUN_00530050 zeroes all of
// them on Hide/before-redraw. The Get* methods are simple reads —
// whichever field is non-zero tells us what kind of tooltip is up.
//
// Verified by decoding the builder functions:
// - BuildItemTooltip (0x0052B650) writes +0x380/+0x384 (item
// GUID, only when there's a real CGItem) and
// +0x398 (itemID) at 0x0052B6CE / 0x0052B6FE.
// - BuildSpellTooltip (0x0052E610) writes +0x39C (spellID) at
// 0x0052E6D5 (param_7==0 branch — skipped for
// the next-rank tooltip side-build).
// - BuildUnitTooltip (FUN_00529FE0) writes +0x368/+0x36C (unit
// GUID) — see SetUnit block below.
// - BuildGameObjectTooltip (0x0052AA20) writes +0x370/+0x374
// (gameobject GUID) at 0x0052AA52 / 0x0052AA59.
// Only call site is the in-world hover handler
// FUN_00492890; no Lua `SetGameObject` method.
// - Clear (FUN_GAMETOOLTIP_CLEAR) zeroes unit(+0x368)/GO(+0x370)/
// itemID(+0x398)/spell(+0x39c) — but NOT the item GUID +0x380/+0x384.
// That omission means the item GUID goes stale across a switch to a
// tooltip that shows no item (SetUnitAura, SetEquipmentSet, …), so
// GameTooltip:GetItem would resolve the *previous* item. We co-hook
// the clear (Tooltip::Clear) to zero +0x380/+0x384 too, so
// every fresh tooltip resets it and only the item builder re-sets it.
// All 14 Set*/builder paths route through this clear, so the co-hook
// covers them uniformly. __fastcall(self).
FUN_GAMETOOLTIP_CLEAR = 0x00530050,
// Vanilla's own, never-exposed "texture on the last line" — `void
// __thiscall(tooltip, const char *texturePath)`, `ret 4`. Unreferenced in
// the 1.12 binary (no calls, no pointers). It takes the next of the three
// textures the XML-OnLoad scan (FUN_00529650) binds from
// `Texture1..3` into OFF_GAMETOOLTIP_TEXTURES (`%sTexture%d`,
// 0x0052987C; the loop stops at 3) and, for the last line N:
// - re-anchors line N TOPLEFT → line N-1 BOTTOMLEFT at (texture width,
// VAR_TOOLTIP_LINE_GAP), reading the width through the texture's
// vtable +0x1C — it never sizes the texture (the template's 12x12);
// - clears the texture's anchors (thunk_FUN_00767620) and anchors its
// RIGHT to line N's LEFT;
// - if line N+1 is in the pool, re-anchors it to line N at
// (-width, gap), cancelling the shift for the lines below;
// - sets the file (FUN_SIMPLETEXTURE_SET_TEXTURE), shows it, records N
// in OFF_GAMETOOLTIP_TEXTURE_LINES and bumps
// OFF_GAMETOOLTIP_NUM_TEXTURES.
// Every re-anchor REPLACES the line's offset, so a second texture on line
// N, or one on line N+1, breaks the layout (`Tooltip::AddTexture` refuses
// both). No-op with fewer than 2 lines or all 3 textures used.
// FUN_GAMETOOLTIP_CLEAR undoes it (0x005300F2..0x005301CF): re-anchors
// line N at (0, gap) but line N+1 at (0, 0), hides the texture and zeroes
// the count (not the line indices). `Tooltip::Clear` restores line N+1's
// gap.
FUN_GAMETOOLTIP_ADD_TEXTURE = 0x005303D0,
OFF_GAMETOOLTIP_TEXTURES = 0x34C, // CSimpleTexture *[3]
OFF_GAMETOOLTIP_TEXTURE_LINES = 0x358, // uint32[3] — line index each texture sits on
OFF_GAMETOOLTIP_NUM_TEXTURES = 0x364, // uint32 — textures in use
// .rdata float -2.0 that the texture routine and the clear pass as the
// line gap in pixels (matching GameTooltipTemplate's TextLeftN y offset),
// converted with the SetPoint pixel → layout-unit chain
// (Game::PixelToInternal).
VAR_TOOLTIP_LINE_GAP = 0x008038DC,
OFF_TOOLTIP_ITEM_GUID_LO = 0x380, // 0 for SetItemByID (no CGItem); stale-safe via the clear co-hook
OFF_TOOLTIP_ITEM_GUID_HI = 0x384,
OFF_TOOLTIP_ITEM_ID = 0x398,
OFF_TOOLTIP_SPELL_ID = 0x39C,
// Auction/compare descriptor. Script_GameTooltip_SetAuctionItem
// (0x00535810) has no CGItem instance, so it stashes the listing's
// random-property (suffix) id at tooltip+0x424 and marks the
// compare-descriptor valid by writing the builder's compare flag to
// this[0x110] (tooltip+0x440) = 1 (SetAuctionItem passes param_6=1;
// every other Set* path passes 0, and the builder writes it on each
// param_7==0 build — so +0x440 is a reliable per-build gate, not
// stale). This is 1.12's analog of 3.3.5's `tooltip[0x130]`-gated
// `piVar5[0x2d]` random-property read in GameTooltip:GetItem. GetItem
// reads +0x424 (only when +0x440 is set) to put the suffix in the link.
OFF_TOOLTIP_COMPARE_FLAG = 0x440,
OFF_TOOLTIP_COMPARE_SUFFIX = 0x424,
// Unit GUID written by the inner unit-tooltip builder
// (FUN_00529FE0) when `tooltip:SetUnit(token)` resolves the token
// to a non-zero GUID. Cleared by the same `FUN_00530050` clear
// that handles the item/spell IDs above, so `(lo|hi) == 0` means
// "no unit currently displayed" — same gating pattern HasSpell /
// HasItem use.
OFF_TOOLTIP_UNIT_GUID_LO = 0x368,
OFF_TOOLTIP_UNIT_GUID_HI = 0x36C,
// GameObject GUID written by the in-world hover tooltip populator
// (FUN_0052AA20) — there is no Lua-callable `SetGameObject` method
// in vanilla, so this slot only ever fills when the player mouses
// over a gameobject in the world (nodes, chests, doors, etc.).
// Same clear/gating semantics as the unit GUID slot.
OFF_TOOLTIP_GAMEOBJECT_GUID_LO = 0x370,
OFF_TOOLTIP_GAMEOBJECT_GUID_HI = 0x374,
// Owner frame stored by `tooltip:SetOwner(frame, anchor)` and
// compared by `IsOwned`. Holds `owner_CObject + OFF_FRAME_LAYOUT_SUBOBJECT`
// (i.e. the LayoutFrame*, not the bare Frame*), or 0 if unowned.
// Verified via the helper at 0x0052FFE0 invoked by SetOwner's tail
// (writes `[this+0x314] = arg+0x24`) and Script_GameTooltip_IsOwned
// at 0x00530FE0 (reads `[edi+0x314]` and compares against the same
// `+0x24`-offset value).
OFF_TOOLTIP_OWNER = 0x314,
// Tooltip layout state — 4.3.4's CGTooltip m_anchorType / m_offsetX /
// m_offsetY / m_padding / m_minimumWidth. Offsets and padding are stored
// in internal units (Game::PixelToInternal), not pixels. Verified from the
// setters: FUN_0052FFE0 (SetOwner's tail) writes owner +0x314, anchor
// +0x318, offsets +0x3C4/+0x3C8; Script_SetPadding writes +0x3BC through
// FUN_00530630; Script_SetMinimumWidth writes the raw width to +0x3C0.
OFF_TOOLTIP_ANCHOR_TYPE = 0x318,
OFF_TOOLTIP_PADDING = 0x3BC,
OFF_TOOLTIP_MIN_WIDTH = 0x3C0,
OFF_TOOLTIP_OFFSET_X = 0x3C4,
OFF_TOOLTIP_OFFSET_Y = 0x3C8,
// The anchor codes `OFF_TOOLTIP_ANCHOR_TYPE` holds. 1.12's own numbering
// (4.3.4's differs: it has ANCHOR_BOTTOM and ANCHOR_TOP in it), read off
// Script_SetOwner's name chain (FUN_005310D0) and the position routine's
// switch (FUN_0052FE90): LEFT 0, RIGHT 1, BOTTOMLEFT 2, BOTTOMRIGHT 3,
// TOPLEFT 4, TOPRIGHT 5, CURSOR 6, NONE 7, PRESERVE 8. That name chain
// is case-insensitive and sends any other name to LEFT.
TOOLTIP_ANCHOR_LEFT = 0,
TOOLTIP_ANCHOR_RIGHT = 1,
TOOLTIP_ANCHOR_BOTTOMLEFT = 2,
TOOLTIP_ANCHOR_BOTTOMRIGHT = 3,
TOOLTIP_ANCHOR_TOPLEFT = 4,
TOOLTIP_ANCHOR_TOPRIGHT = 5,
TOOLTIP_ANCHOR_CURSOR = 6,
TOOLTIP_ANCHOR_NONE = 7,
TOOLTIP_ANCHOR_PRESERVE = 8,
// ClassicAPI's own codes for the two names 4.3.4 has and 1.12 does not.
// The engine never stores them; its position routine falls out of its
// switch for any code above 5, which is why `Tooltip::Layout` hooks it. Its
// fade code treats every code but CURSOR as "fade" (FadeOut, 0x00530AE0),
// and GetAnchorType's default is "ANCHOR_NONE".
TOOLTIP_ANCHOR_TOP = 9,
TOOLTIP_ANCHOR_BOTTOM = 10,
// The position routine — `__thiscall(tooltip, int force)`, `ret 4`; 4.3.4's
// CGTooltip::ResetPosition. Does nothing without an owner or for PRESERVE.
// Unless the type is NONE (or `force` is 0), it first clears the frame's
// points (FUN_00767ED0), then re-anchors for the six corner types with
// FUN_00767C70(this + 0x24, point, owner, ownerPoint, x, y, 1). CURSOR
// gets no anchor here — it follows the mouse elsewhere. The same switch
// runs on every SetOwner.
FUN_TOOLTIP_RESET_POSITION = 0x0052FE90,
// CGItem → fully-dressed item link string. __fastcall(ecx = CGItem *)
// → const char *. Reads the item's itemID, quality, permanent
// enchant ID, random-properties seed/factor, and unique ID off the
// CGItem's instance block + descriptor, builds the dressed name via
// FUN_005D8BC0 (handles random-suffix decoration like "Foo of the
// Bear"), then sprintf's into the global buffer at DAT_00C0CF68 and
// returns its address. The returned pointer is to a long-lived
// engine global, safe to read until the next call.
//
// Same helper Script_GetContainerItemLink (0x004F9930) and
// Script_GetInventoryItemLink (0x004C8C10) call after resolving
// their slot-form args. Bypassing them lets us build dressed links
// for tooltips set via SetMerchantItem / SetLootItem / etc. where
// the item isn't in the player's bag/equipment.
FUN_GAMETOOLTIP_BUILD_ITEM_LINK = 0x0052AE00,
// CGItem → decorated instance display name. __thiscall(ecx = CGItem *,
// char *outBuf, uint outSize). Reads the instance's random-suffix ID
// off the descriptor (+0x98, gated on the broken flag) and writes the
// plain — uncolored, unbracketed — display name into outBuf:
// "Ethereum Torque of the Sorcerer" when a suffix is present, the base
// ItemStats name otherwise (via the item cache + ItemRandomProperties
// localized suffix at record +0x1c). This is the inner name builder
// FUN_GAMETOOLTIP_BUILD_ITEM_LINK wraps in brackets, so the name it
// produces matches GetItemLink's bracketed name and modern
// C_Item.GetItemName exactly. Inner formatter FUN_005D8B00.
FUN_ITEM_BUILD_INSTANCE_NAME = 0x005D8BC0,
// Inner name formatter behind FUN_ITEM_BUILD_INSTANCE_NAME, callable
// WITHOUT a CGItem: `__fastcall(char *out /*ecx*/, uint outSize /*edx*/,
// uint32 itemID, int suffixID)`. Fetches the ItemStats record for itemID
// and, when suffixID is a valid ItemRandomProperties row with a localized
// suffix name (record +0x1c + locale*4), formats base + suffix via
// ITEM_SUFFIX_TEMPLATE; otherwise the base name. Lets the by-STRING item
// paths (GetItemNameByID, C_Item.GetItemInfo) apply an item link's random
// suffix without a live item instance.
FUN_ITEM_BUILD_NAME_FROM_ID = 0x005D8B00,
// Engine's inventory swap-and-send. Same primitive
// `Script_EquipCursorItem` (0x00489660) uses after the cursor's
// source location has been resolved. Sends opcode 0x10D
// (CMSG_SWAP_INV_ITEM) for same-container swaps or 0x10C
// (CMSG_SWAP_ITEM) for cross-container, then runs the packet
// through the engine's own send pipeline at FUN_005AB630.
// (0x10C is SWAP_ITEM; CMSG_AUTOEQUIP_ITEM is 0x10A and belongs to
// the cursor/equip builder FUN_005E1480, not this one.)
//
// Signature:
// void __thiscall(
// CGPlayer *this,
// u32 srcItemGuidLo, u32 srcItemGuidHi,
// u32 srcContainerGuidLo, u32 srcContainerGuidHi,
// u32 srcLinearSlot,
// u32 dstContainerGuidLo, u32 dstContainerGuidHi,
// u32 dstLinearSlot,
// int flag);
//
// `flag` IS NOT COSMETIC — it gates a pre-send confirmation check,
// and with 0 this function can decide to send NOTHING AT ALL.
// Before building the packet, and only when the DESTINATION is not
// an equipment or bag-container slot, it resolves the item being
// moved (the destination's item when the source is an equipment
// slot, otherwise the source's) and then either:
// - stashes the parameters and returns, when that item is not in
// the item cache yet; or
// - stashes the parameters, fires event 0x120 (the bind
// confirmation dialog) and returns, when the item's `m_bonding`
// (record +0x194) is 2 (BIND_WHEN_EQUIPPED) and `FUN_005EA930`
// reports this character could equip it.
// Both paths send no packet and report nothing, since the function
// returns void — so a caller that moves a Bind-on-Equip item it
// could wear just silently does not move it.
//
// Passing 1 skips the gate, which is what the engine itself does
// when it re-issues a swap after the player accepts the dialog. That
// is correct for any caller whose two endpoints are both bag content
// slots, since nothing there can bind an item.
//
// Linear-slot encoding for sources/dests in player invMgr:
// 0..18 paperdoll (1-based slot - 1)
// 19..22 equipped bag containers (bag IDs 1..4 themselves)
// 23..38 backpack contents (1-based bag-0 slot S → 22 + S)
// For sources in a CGContainer (equipped bag B = 1..4), the
// container GUID is the bag's own GUID and srcLinearSlot is
// 0-based within that bag (1-based Lua slot - 1).
//
// This call neither reads nor writes the cursor-state globals at
// [0xBE0810] / [0xBE0814]; cursor visibility is purely a side
// effect of the cursor-pickup path that normally precedes it.
// Calling this directly produces a server-side swap with no
// client-side cursor manipulation.
FUN_INVENTORY_SWAP = 0x005E0C40,
// Sister helper to FUN_INVENTORY_SWAP — packet builder for
// `CMSG_SPLIT_ITEM` (opcode 0x10E). Same __thiscall ABI shape;
// the item-GUID args (param_1, param_2) are unused padding for
// ABI parity. Packet wire format:
// [0x10E, srcBag, srcSlot, dstBag, dstSlot, count]
// where srcBag/dstBag are byte-converted from container GUIDs by
// the same `FUN_005e13b0` helper the swap function uses
// (`0xFF` = INVENTORY_SLOT_BAG_0 / player, `19..22` = equipped bags).
//
// Server semantics are all-or-nothing: any failure
// (insufficient source, dest has different item, dest would
// overflow maxStack) leaves source untouched and emits
// `SMSG_INVENTORY_CHANGE_FAILURE`. No cursor involvement on send
// or response.
//
// Signature:
// void __thiscall(
// CGPlayer *this,
// u32 unused1, u32 unused2, // ABI padding
// u32 srcContainerLo, u32 srcContainerHi,
// u32 srcLinearSlot, // only low byte hits the wire
// u32 dstContainerLo, u32 dstContainerHi,
// u32 dstLinearSlot, // only low byte
// u32 count); // only low byte
FUN_INVENTORY_SPLIT = 0x005E1210,
// Third sibling in the same packet-builder family — `__thiscall`,
// same shared bag-byte converter (`FUN_005E13B0`), same send
// pipeline (`FUN_005AB630`). Builds `CMSG_AUTOSTORE_BAG_ITEM`
// (opcode 0x10B): "take this item and put it wherever it belongs
// in that container", with the DESTINATION SLOT CHOSEN BY THE
// SERVER. Wire format:
// [0x10B, srcBag, srcLinearSlot, dstBag]
//
// Signature — EIGHT stack args, `RET 0x20`. The count is from the
// RET, not from a decompiler parameter list: the last slot
// (`EBP+0x24`) is never READ by the body, but it IS popped, so a
// 7-arg declaration leaves the callee popping four bytes too many
// and ESP walks on every call. Trailing-ignored-arg is this
// family's habit — it is where swap keeps its `flag` and split its
// `count` — but the family is NOT uniform in arity: those two take
// nine (`RET 0x24`), this one eight.
// void __thiscall(
// CGPlayer *this,
// u32 unused1, u32 unused2, // EBP+0x08/+0x0C, unread
// u32 srcContainerLo, u32 srcContainerHi,
// u32 srcLinearSlot, // only low byte hits the wire
// u32 dstContainerLo, u32 dstContainerHi,
// u32 unused3); // EBP+0x24, unread but popped
//
// Note there is no dst slot argument at all — that is the point of
// the opcode. Server-side (`HandleAutoStoreBagItemOpcode`) it runs
// `CanStoreItem(dstBag, NULL_SLOT, …)`, which is a TWO-PASS search:
// first "merge into existing non-full stacks of this item" (filling
// a position/count vector, so one stack can be distributed across
// several destinations), then "find a free slot" for whatever count
// is left. So this single packet performs partial-stack
// consolidation with no stack-size lookup on our side at all.
//
// Note the value in that is NOT that the client's stack size could
// be wrong: 1.12 has no item DBC, so stack size arrives from the
// server and is cached in itemcache.wdb, and the client's copy
// normally agrees by construction. The value is availability —
// `C_Item.GetItemMaxStackSizeByID` is nil until an item's data has
// arrived, so anything that sizes stacks first has a cold-cache
// hole, and the server never needs to size them.
//
// The converter returns `0xFF` for any GUID absent from the
// player's invMgr container array, and the player's own GUID is
// absent — so passing the PLAYER as the destination sends
// `dstBag = 0xFF` (INVENTORY_SLOT_BAG_0), which the server reads as
// "search every bag". The builder guards that case: a converted
// `0xFF` is only allowed through when the destination GUID really is
// the player's, otherwise it drops the send silently. Consequence:
// the backpack is not separately addressable as a destination (it
// IS the player container), so bagID 0 means "anywhere it fits".
FUN_INVENTORY_AUTOSTORE = 0x005E12E0,
// Bank counterpart — `CMSG_AUTOSTORE_BANK_ITEM` (opcode 0x282).
// THREE stack args, `RET 0xC`. Wire: [0x282, srcBag, srcSlot].
// void __thiscall(
// CGPlayer *this,
// u32 srcContainerLo, u32 srcContainerHi,
// u32 srcLinearSlot); // only low byte hits the wire
//
// No destination of any kind, because the server DERIVES THE
// DIRECTION FROM THE SOURCE (`HandleAutoStoreBankItemOpcode`):
// a bank source runs `CanStoreItem(NULL_BAG, NULL_SLOT, …)` and
// lands in the inventory; an inventory source runs
// `CanBankItem(NULL_BAG, NULL_SLOT, …)` and lands in the bank.
// Both are the same merge-into-existing-stacks-then-free-slot
// search as 0x10B, just aimed at the other side.
//
// So this opcode moves an item ACROSS the inventory/bank boundary
// and cannot move one within its own side. Bank-internal
// consolidation is not expressible through autostore at all — it
// needs per-pair moves (`FUN_INVENTORY_SPLIT` / `_SWAP`).
//
// Unlike its siblings this one validates the source itself before
// sending: resolves the container by GUID (`FUN_00468460` with
// typeMask 1), bounds-checks the slot against the container's item
// array, and bails when the GUID in that slot is zero.
FUN_INVENTORY_AUTOSTORE_BANK = 0x005E18F0,
// Registers a single global Lua function. __fastcall(name, func).
FUN_FRAMESCRIPT_REGISTER_FUNCTION = 0x00704120,
// `FrameScript_Object::ScriptRegister(this, name)` — `__thiscall`,
// `this` = a `CFrameScriptObject *`. On first call (when `this+0x04`
// is zero) builds a Lua wrapper table `{[0] = lightuserdata(this)}`
// with `_G["__framescript_meta"]` as metatable, `luaL_ref`s it into
// the registry, stores the refkey at `this+0x08`. Always increments
// `this+0x04` (the Lua-side refcount). Optional `name` argument
// installs `_G[name] = wrapper` for engine-named frames.
//
// We call this in `PushNamePlateFrame` so the engine and our own
// C_NamePlate getters operate on the **same** wrapper table —
// every push through `lua_rawgeti(REGISTRY, this+0x08)` (the
// canonical engine path) lands on the same Lua object pfUI
// received in `NAME_PLATE_CREATED`, so addon-set fields
// (`plate.nameplate = decoratedButton`) survive engine-side
// re-fetches. Earlier note in `Info.cpp` warned about pinning the
// refcount; for pool-managed nameplates the engine never
// un-registers them anyway, so the pin is benign.
FUN_FRAMESCRIPT_OBJECT_SCRIPT_REGISTER = 0x00701BD0,
// The rest of the script-object life cycle (benilla-re ui/script, ui/frames):
// FUN_SCRIPT_OBJECT_CONSTRUCT `__fastcall(object)` fills the 0x24-byte
// header: base vtable, holder count 0 (+4), table ref -2 (+8), OnEvent
// slot (+0xC), event index (+0x14..+0x20).
// FUN_SCRIPT_OBJECT_DESTRUCT `__fastcall(object)` unregisters its events,
// releases OnEvent and frees the index array.
// FUN_SCRIPT_OBJECT_UNLOCK `__thiscall(object, name)` - the inverse of
// FUN_FRAMESCRIPT_OBJECT_SCRIPT_REGISTER: counts a holder down, at zero
// clears the table's [0] and frees its ref; a non-null name's global
// is set to nil.
// FUN_SCRIPT_OBJECT_BASE_RESOLVE_SCRIPT `__thiscall(object, name)` - the
// base vtable+0x0C: the OnEvent slot for "OnEvent", else 0.
// FUN_SCRIPT_OBJECT_SET_SCRIPT_TEXT `bool __thiscall(object, name, text)`,
// `ret 8` - compiles an XML script body into the slot vtable+0x0C
// gives (chunk name ":