Commit Graph
16 Commits
Author SHA1 Message Date
MarcelineVQ db1243d136 Add marker persistence, respawn, group sync, and fix pushnumber ABI
Marker definitions (position + area ID) now persist across zone
transitions. Entities are destroyed on map change but respawned
automatically when the player approaches within 200y. Definitions
are cleared on logout/exit via onShutdown hook.

Group sync via addon messages (WMark prefix, colon-delimited protocol)
with permission checks (raid leader/assist, party leader). Includes
sync request/response for late joiners and roster change broadcasting.

Fix lua_pushnumber calling convention: function is __thiscall (ECX=L,
f64 on stack, ret 8), not __fastcall. The patched inreg fastcall was
placing the f64's low dword in EDX, corrupting values.

Other fixes:
- Remove Bindings.xml from .toc files (explicit binding loader needed)
- Remove remove_on_shutdown for markers (was killing hooks on logout)
- Remove diagnostic entity check code (culling behavior understood)
- New Lua APIs: SetMarkerDef, ClearMarkerDef, GetMarkerDef
- Rename binding labels to marker colors
2026-03-02 11:45:26 -08:00
MarcelineVQ bf718b66db Harden group sync: SF dedup, roster debounce, area ID filter
- SF first-responder lock: after sending SR/LSR, only accept SF
  messages from the first player to respond, ignore duplicates
  from other members to prevent entity flicker.
- Roster change debounce: retriggerable 5s timer with up to 5
  one-second extensions (10s max). Only fires on group size
  increase. Party events skipped when in raid.
- Area ID check in DLL respawn: markers only spawn when the
  player is in the same zone (area_id match against 0xB4E314).
- New GetCurrentAreaId() Lua function for addon zone awareness.
2026-03-02 11:26:10 -08:00
MarcelineVQ 6778437638 Add marker persistence, proximity respawn, and group sync
Markers now survive zone transitions via persistent MarkerDef structs
(position + area ID) that are NOT cleared during world teardown. The
per-frame tick detects zombie entities (refcount <= 1 from game culling)
and respawns markers when the player approaches within 200 yards.

New DLL Lua APIs: SetMarkerDef, ClearMarkerDef, GetMarkerDef for the
addon to store/query definitions without immediate entity creation.

Addon layer adds group sync via CHAT_MSG_ADDON messages using colon-
delimited protocol (P:idx:x:y:z:area, C:idx, CA, SR, SF:...). Wraps
WorldMarker/ClearWorldMarker to broadcast on placement. Permission
model: raid leader/assist or party leader only.

Fix lua_pushnumber calling convention: Ghidra confirms it is thiscall
(ECX=L, f64 on stack [EBP+8]/[EBP+0xc], ret 8), not fastcall. The
patched inreg fastcall was shoving the f64's low dword into EDX,
producing garbage values like 1.17e-250 from 1810.
2026-03-02 10:38:15 -08:00
MarcelineVQ 7e28c81db0 Tune marker animation: 2000ms Hold queue delay
Empirically tested delay thresholds (100/500/1000/2000/3900ms).
Delays under ~2s cause the engine's blend logic to accelerate the
Stand grow-in animation. 2000ms is the shortest delay that preserves
full-speed Stand across all 5 marker colors.

Also confirmed all 5 Raid_UI_FX M2 models have identical animation
sequence entries (Stand→Hold→loop chain via nextAnimation fields),
but the engine doesn't honor the chain — explicit PlayBoneAnimation
queue is still required.
2026-03-02 08:58:43 -08:00
MarcelineVQ e474b61c37 Move marker animation tick to DLL-side OnWorldUpdate hook
- Hook OnWorldUpdate (0x482EA0) for per-frame tick while world is active
- Remove Lua OnUpdate animation driver (ProcessMarkerAnimations)
- Add DistanceToMark(index) Lua API returning player-to-marker distance
- Track marker positions DLL-side for distance queries
- Clean up positions on marker clear and world teardown
2026-03-02 08:31:23 -08:00
MarcelineVQ 475070e910 Fix marker crash on logout and add module lifecycle table
The marker cleanup hook on CleanupWorldAndEntities was never installed —
markers.installHooks() was missing from install() in main.zig. Entities
created via WorldMarker were never cleaned up before the game's atexit
handler iterated the hash table over freed heap memory.

Key changes:
- Add markers.installHooks() call (the actual crash fix)
- Replace manual install/uninstall/shutdown lists with a single modules
  table that drives all three phases — prevents this class of bug
- Gate marker Lua functions, addon, and keybindings behind isActive()
  so they're skipped when another DLL owns the hooks
- Add world_cleanup_hook.detach() to removeHooks() (was missing)
- Migrate from vendored libs/hook to external zhook dependency
- Unify installHooks return types to void across all modules
- Add diagnostic logging to marker cleanup (temporary, for testing)
2026-03-02 07:34:18 -08:00
MarcelineVQ 1ec9d8d433 Smooth Stand→Hold animation transition with 100ms blend
- Set Hold blendTime=100ms in all 5 M2 files (was 0ms, causing jarring snap)
- Play Hold 100ms before Stand ends (3900ms) for overlap blend
- Set Stand.nextAnim=1, Hold.nextAnim=1 in M2 data for engine chaining
- Revert Hold duration from 300000ms (test residue) back to 4000ms
2026-03-02 04:23:56 -08:00
MarcelineVQ bc731bb1eb Fix marker Hold animation glitch and simplify animation control
M2 changes (all 5 Raid_UI_FX models):
- Set Stand nextAnim=1 to chain to Hold via engine's native mechanism
- Set Hold nextAnim=1 for self-loop chain
- Revert Hold duration from 300000ms (test residue) to 4000ms
- Fix Bone1 rotation quaternion loop: match last keyframe to first,
  fix hemisphere flip at 180° keyframe, zero X/Y drift in keyframes 6-9

markers.zig:
- Remove Hold re-queue logic (was causing blend transition glitches)
- Queue Hold once after Stand duration instead of every 1500ms
- Remove debug logging (process_call_count, per-frame dumps)
2026-03-02 04:13:34 -08:00
MarcelineVQ c70d39b1ea Add cursor terrain placement and marker animation control
Cursor terrain: UpdateHitTest raycast through mouse cursor, zero-before-check
to distinguish terrain hits from no-hit (both return hitType=0 outside AoE).

Animation: PlayBoneAnimation wrapper calls Stand->Hold on spawn, Decay on
despawn with lazy 700ms deferred cleanup. Not yet working correctly --
animations may not be taking effect or IDs may need verification.
2026-03-01 18:08:36 -08:00
MarcelineVQ d59cf42514 Replace test marker with WorldMarker/ClearWorldMarker Lua API
5 marker slots (Yellow, Cyan, Green, Purple, Red) with placement
by coords, unit ID, or cursor position (stubbed pending terrain
offset research). Key bindings for all 5 markers + clear all.
2026-03-01 16:23:51 -08:00
MarcelineVQ 2cca8f4b53 Add assetfix, transmogfix, minimapicons modules; fix assetfix disk-vs-MPQ priority
Assetfix: hook CheckFileExistence to serve loose Data\ files. The original
flags|1 approach failed because game paths contain backslashes, causing
CheckFileExistence to skip BuildFilePath and check the raw path (no Data\
prefix). Fix: write the correct Data\-prefixed disk path to the output buffer
directly and return 1, bypassing the original function for hash map hits.
This preserves hook chaining (filename argument is never transformed).

Also adds transmogfix (transmog update coalescing), minimapicons (stub),
new build options for all three modules, mutex-based multi-DLL safety,
embed .skin data into .m2 models, and various module improvements.
2026-02-28 14:07:53 -08:00
MarcelineVQ 6a290439c6 Document UpdateWorldPosition grid snap, fix BLP cleanup crash, remove test offsets
- cleanupFileHandleDetour: always delegate to original CleanupFileHandleResources
  trampoline instead of manual callCleanupFileContext+freeGameBuffer (fixes SMemFree
  crash at EIP=0x23 for BLP texture contexts)
- Add ECX to callCleanupFileContext clobber list (correctness fix)
- Document UpdateWorldPosition (0x698110) terrain chunk grid snapping behavior on
  createEntityInstance — updateNow=1 modifies position in-place
- Remove debug +10/+10 XY offset from marker placement
2026-02-28 07:50:10 -08:00
MarcelineVQ a8ebe21b0d Add hook 5 (loadModelFromFileAsync), combatlog stub, framecrash vtable hooks, marker assets
Hook 5 intercepts loadModelFromFileAsync (0x71d4e0) to synchronously load M2
model data for fake in-memory file contexts. processLoadedModelData returns 1
and entities are created, but file context cleanup is currently skipped (leaks
0x60 bytes per load) due to a crash in the cleanup path, and there's a later
EIP=0 crash during the game main loop that needs investigation.

Also adds: combatlog module stub, framecrash anchor vtable hooks (GetRelativeTo
and GetWidth/GetHeight crash guards), embedded Raid_UI_FX model assets with
skins and textures, WU_XYZ debug model.
2026-02-27 16:47:42 -08:00
MarcelineVQ fe1bfdedb8 Fix marker destruction: use CleanupEntity_ProcessAttachments (0x670d50)
The native high-level destructor counterpart to CreateEntityInstance_WithAttachment.
Properly detaches from render lists and scene graph before freeing memory,
fixing the delayed crash from dangling pointers in the per-frame render path.
2026-02-27 12:14:29 -08:00
MarcelineVQ ab6f5ea4b9 Replace manual world object creation with native CreateEntityInstance_WithAttachment API
Markers are now created via the game's high-level entity factory (0x6707c0)
which handles spatial registration, render setup, and lifecycle internally.
Removed ~300 lines of dead code: manual game object list insertion, A/B mode
switching, parity scanning, and model attachment wrappers.

Creation works (markers visible). Destruction still crashes — needs correct
destructor for entities created via CreateWorldUnit path (not DestroyWorldObjectAndRelease).
2026-02-27 11:18:48 -08:00
MarcelineVQ 37d42d09c2 Add markers module, framecrash stub, debug console, build-flag wiring
Markers: client-side world object system using CreateGameObject. Places
M2 models at arbitrary world positions via Lua commands (/mark test,
/mark pos). Includes embedded addon, xyz.m2/blp assets served from DLL
memory, position helpers from unit movement struct, and object lifecycle
management (create, cleanup, reposition, alpha, animation).

Framecrash: stub module with reference to crash at 0x007A2452.

Console: debug output via AllocConsole/WriteConsoleA, compiles out
entirely in non-Debug builds. Used by markers and file serve logging.

Build: markers added to feature flag matrix and all-variants step.
Main: conditional markers import, Lua function registration, embedded
addon + asset file serving, console init/deinit lifecycle.

Outline README: added misc planned features and debug mode notes.
2026-02-26 15:30:21 -08:00