The combat/chat log path global updates are logsessions-specific and
don't belong in the core addon. Created a dedicated LogSessions addon
with its own TOC, embedded file entries, and conditional loading.
UpdateWorldPosition (called during entity creation) snaps X/Y to the
terrain chunk grid, causing markers to appear offset from the requested
position. After creation, re-apply the exact position via
SetUnitPositionAndOrientation (0x698e20) to override the grid snap.
UpdateHitTest returns hit type 2 (object) when the cursor is over a
unit/game object, with the intersection point landing at the camera
position rather than the object. Detect object hits via the hit type
field and resolve the object's actual world position from its GUID
stored in the HitTestResult.
Register Lua functions to expose current log paths. At PLAYER_LOGIN,
overwrite COMBATLOGENABLED/CHATLOGENABLED globals with actual redirected
paths (English locale only). Update DLL_README with Lua API and logging
enable instructions.
Write CHAT_SESSION and COMBATLOG_SESSION markers on first write to each
log type. Raw combat log handle address captured dynamically from
SuperWoW's InitializeLogBuffer call.
Read character name from select screen data and realm from CVar when
the player clicks Enter World, before InitializeLogBuffer fires.
Removes GUID/name-cache fallback — no more early passthrough to wrong paths.
Organize combat/raw/chat logs into Logs\<realm>\<char>\ directories.
Lazy path setup on first InitializeLogBuffer call resolves character
and realm names, creates directory tree, and reuses files modified
within 30 minutes for session continuation. Chat log added to the
redirection system. Session marker now includes realm name.
Paths not yet redirected before login — needs earlier hook point.
SuperWoWhook.dll calls InitializeLogBuffer directly with hardcoded
"Logs\WoWCombatLog.txt", bypassing the path pointer table. Hook
InitializeLogBuffer itself to intercept the path argument and
substitute our timestamped filename, regardless of caller. Also
redirects WoWRawCombatLog.txt to a matching timestamped file.
TODO: session marker (COMBATLOG_SESSION) needs to be written as the
first line in each log file -- currently it appears after SuperWoW's
initial writes (COMBATANT_INFO, ZONE_INFO) because the write hook
fires too late.
TODO: consolidate small/empty WoWCombatLog_*.txt files on startup.
SetMarkerDefSync checked canSetMarkers() on the local player, which
blocked non-leaders from receiving sync data. Now SF messages use the
same SetMarkerDef (senderHasPermission) check as P messages.
Protocol change: sync responder sends SF: for each marker then SD to
signal completion. Requester enters sync mode with a 5s fallback timer,
locks to first SF sender, and exits on SD. Non-syncing clients ignore
SF/SD. Consolidated login delay and sync timeout into one timer frame.
Instead of hooking EnableChatLogging or SignalEvent (which fire too late
or before the log file is open), hook WriteFormattedLogMessage directly.
On the first write to the combat log, prepend COMBATLOG_SESSION with the
player name resolved via the name cache. This guarantees the session
marker is the very first line in the file.
Also add World_HandleLogoutCleanup (0x491180) hook to reset per-session
state on real logout/disconnect (not /reload), and move remove_on_shutdown
cleanup from shutdownDetour to logoutDetour.
Switch from GetObjectPtr→GetUnitName (object manager, not populated
at LoggingCombat time) to RetrieveNPCDataFromCache (name cache,
available early). Remove the SignalEvent probe hook that was only
for discovery.
Ghidra disasm confirms RET 0xC (callee cleans 3 args). Third arg is a
va_list pointer, not the variadic args directly. For %s, vsprintf reads
*(char**)va_list -- previous code passed &name_buf causing vsprintf to
interpret "Munj" (0x6A6E754D) as a char* and crash at strlen.
Fix: pass &name_ptr (pointer to the char*) and remove caller stack
cleanup. Added detailed research to RESEARCH.md.
The old code called GetObjectByGUID (0x464870) as __fastcall with the
GUID in ECX/EDX, but the function is actually __stdcall with the u64
GUID on the stack. This ABI mismatch caused a crash.
Switched to perfboost's two-step approach with correct conventions:
1. GetObjectPtr (0x464870) — __stdcall(u64 guid) → object ptr
2. CGUnit_C::GetUnitName (0x609210) — __thiscall(ECX=unit, 0) → char*
Also added ESI/EDI/EBX clobber barrier in the EnableChatLogging detour
and copy name to stack buffer before log write.
- dataassets module renamed to customassets everywhere (build flag,
source, DLL variant name, docs)
- Markers addon renamed to WorldMarkers (addon path, .toc, .lua,
Bindings.xml header, Lua globals, debug log prefix, mutex name)
- All 9 module mutexes now use WeirdUtils_ prefix to avoid
collisions with other DLLs in the same process
Root cause: hook.fastcall used "r" constraints + explicit MOV to set
ECX/EDX. LLVM can allocate "r" inputs to clobbered registers, causing
cross-assignment (ecx_in→EDX, edx_in→ECX) or function address stomping
when func lands in ECX/EDX. Debug works by luck (trivial regalloc);
Release optimizes aggressively and hits the conflicts.
Fix: explicit "{ecx}", "{edx}", "{eax}" register constraints in zhook
fastcall — compiler places values directly, no MOV needed, no ambiguity.
Also fix 9 inline asm blocks across main.zig, interact.zig,
screenshot.zig, markers.zig missing ECX/EDX clobbers after CALL
instructions. Without clobbers the optimizer assumes registers retain
input values after the call — stale reuse in release builds.
Other changes in this commit:
- Rename markers→worldmarkers (build flag, DLL, Lua table)
- Rename assetfix→looseassets
- lua.zig: add .never_tail to pushcclosure, pcall, openlib, pushnumber
- Move internal marker functions into WorldMarkers Lua table via openlib
- Remove unused GetCurrentAreaId function
- Fix cleanup_file_handle_hook.original() → .callOriginal()
Replace Lua-side permission checks with direct memory reads in the DLL.
All marker mutation functions now verify sender identity against the
raid roster / party leader GUID without touching Lua state.
- Add getPlayerGUID (0x468550), getNameFromGUID (name cache at 0xc0e228)
- Add canSetMarkers: checks local player is leader/officer via roster
- Add senderHasPermission: verifies sender name against roster ranks
- Add senderInGroup: weaker check for sync relay (any rank)
- WorldMarker/ClearWorldMarker return 1/nil for addon feedback
- SetMarkerDef/ClearMarkerDef take sender name param, verify DLL-side
- SetMarkerDefSync: dual check (local=leader + sender in group)
- CanSetMarkers() Lua function for addon broadcast decisions
- Remove Lua-side canSetMarkers/senderHasPermission from Markers.lua
- Add offsets: LEADER_GUID, RAID_ROSTER_ARRAY, RAID_MEMBER_COUNT, etc.
Move Lua C API wrappers from main.zig's lua struct into src/lua.zig
so both main.zig and markers.zig import from the same source. Remove
duplicate lapi struct from markers.zig.
Add DLL-side permission gating on WorldMarker/ClearWorldMarker: calls
WoW's IsPartyLeader (0x4e9130) and IsRaidOfficer (0x4bb910) C
functions directly. Requires party leader, raid leader, or raid
assist to place or clear markers. SetMarkerDef/ClearMarkerDef remain
ungated (addon validates sender before calling).
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
- 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.
- SR handler no longer requires sender permission (anyone can ask for
marks). Split into SR (only leader/assist responds) and LSR (anyone
with defs responds, for leader relog recovery).
- Login sync uses 5s delayed timer so group roster is populated first.
- Timer cancelled if leader places a mark before it fires.
- SF (sync response) accepted from anyone without permission check.
- Colon delimiter instead of pipe to avoid WoW color escape errors.
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.
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.
- 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
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)
Detect SuperWoW version at runtime by scanning the DLL for
SUPERWOW_VERSION="..." and match against known PatchSet entries.
This allows adding patches for future SuperWoW versions without
losing support for older ones. Skips gracefully if version is
unrecognized.
Patches SuperWoWhook.dll handler function in memory to skip duplicate
floating combat text creation. Unlike the reference repos which patch
the DLL on disk (preventing hook registration), this patches the live
handler to JMP over its text creation and fall through to the original.
Also redirects HoT text handler pointers for correct color.
- 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
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)
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.
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.
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.
The manual callCleanupFileContext + freeGameBuffer path crashed inside SMemFree
(EIP=0x23, heap metadata corruption). The original CleanupFileHandleResources
handles fake contexts correctly (NULL-safe on handle fields), so always delegate
to the trampoline instead.
Also adds ECX to callCleanupFileContext clobber list, adds M2 file handle cleanup
before processLoadedModelData (matching onModelLoadComplete ordering), and adds
debug logging throughout the async model load path.
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.
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.
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).
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.
- Each module (outline, interact, screenshot) now has its own addon/
subdir with .toc, .lua, and Bindings.xml
- Core WeirdUtils addon lives in src/core/addon/
- build.zig supports compile-time feature gating via -D options
- main.zig uses build_options for conditional imports and addon embedding
- Module addons only load when their module is compiled in
- 'zig build all-variants' produces full.dll + 3 single-module DLLs
Render order: 3-way M2 batch partition — game objects + local player
render first (write depth), then outline targets (stencil marks), then
other players/gear/NPCs. Outlines show through other players but are
occluded by world/WMO/game objects/local player.
Stencil protection: set STENCILWRITEMASK=0 after outline target DIPs
to prevent subsequent renders from overwriting stencil marks.
JFA sentinel: changed from (1,1) to (-1,-1) to move it outside UV
space. Did not fix banding but is correct regardless.
Debug: added DEBUG_SHOW_SILHOUETTE comptime flag to bypass JFA and
composite raw silhouette RT. Confirmed silhouette is clean — banding
is in the JFA pipeline, not stale vertex buffers.
Game object + local player tracking in tracker.zig for batch ordering.
Added project README and outline subsystem README documenting render
pipeline, architecture, known issues, and planned features.