Commit Graph

81 Commits

Author SHA1 Message Date
MarcelineVQ 95df207eb8 Hide embedded addons from login addon list via +0x29 flag
All embedded addons now register through LoadAddonTOC (no more
separate hidden loading path). For addons marked hidden, walk the
addon linked list after registration and set the +0x29 exclusion
byte so DeserializeAddonData skips them when building the flat
display array. Removes the LoadAddonsRecursively hook since the
game's native LoadAddonRecursive handles all addon loading.
2026-03-08 13:13:46 -07:00
MarcelineVQ 7ccab8f802 Extract addon management into addons.zig with is_active gating
Move embedded file table, addon registration hooks, and loading logic
from main.zig into addons.zig. Each module's is_active callback gates
addon loading on mutex ownership so individual DLLs only load addons
for modules they control. Addon hooks are skipped entirely at comptime
when no addon-bearing modules are compiled in.

Also consolidates CheckFileExistence hook — customassets no longer hooks
it directly, instead exporting looseFilesLookup for main.zig's hook.
2026-03-08 12:59:51 -07:00
MarcelineVQ 9e4cbe4aaf Hook CheckFileExistence so game natively loads addon Bindings.xml
Move the CheckFileExistence (0x654DD0) hook from customassets into
main.zig's core file hooks. Embedded files now pass the game's
preloadFileWithFlags check, so LoadAddonRecursive handles Bindings.xml
loading naturally — respecting addon enabled/disabled state. Only hidden
addons still need explicit binding loading.
2026-03-08 12:37:59 -07:00
MarcelineVQ 00e7e8b472 Use [WeirdUtils] prefix in addon TOC titles for consistent display 2026-03-08 12:24:52 -07:00
MarcelineVQ d2f91fe8c2 Replace screenshot addon with screenshotQuality CVar
Remove the embedded Screenshot addon (TOC + Lua) and WeirdUtilsScreenshot()
Lua function. Compression quality is now controlled entirely via a CVar
(saved to config.wtf), read fresh on each screenshot. CVar 0 disables PNG
and falls through to original TGA.
2026-03-08 12:24:19 -07:00
MarcelineVQ 6ce091607f Rename embedded addons to WeirdUtils_<name> namespace
Prefix all addon folder names with WeirdUtils_ to avoid collisions
with real addons. Rename SavedVariables global from UI_MinimapIcons
to WeirdUtils_MinimapIconsSettings.
2026-03-08 11:30:04 -07:00
MarcelineVQ 4052f8b26f Register DLL-embedded addons via LoadAddonTOC for SavedVariables support
Hook SetupAddonProcessing (0x51C740) to call LoadAddonTOC for each
embedded addon after the game's directory scan. This registers them in
the internal addon hash table so the game handles SavedVariables
loading/saving, file loading, and ADDON_LOADED events natively.

- Add SavedVariablesPerCharacter: UI_MinimapIcons to .toc
- Add VARIABLES_LOADED handler to load/initialize toggle state
- Add default=1 for Innkeeper, Repair, Brainwasher categories
- Write UI_MinimapIcons on toggle for save-on-logout persistence
- Remove manual callLoadFileListWithIncludes (game handles it now)
- Keep explicit Bindings.xml loading (preloadFileWithFlags bypass)
2026-03-08 11:25:01 -07:00
MarcelineVQ cd7c867f00 Add embedded Brainwasher/Poison BLP assets, fix GO tracking activation
Convert custom icon PNGs to BLP2 DXT5 with correct header layout
(mipSizes at 0x54). Fix hasActiveTracking() to check g_go_id_tracking
so brainwasher works standalone. Support per-category scale in Lua.
2026-03-08 10:05:41 -07:00
MarcelineVQ d28b6c8e04 Add Brainwasher GO tracking and Repair Bot reagent override
Add gameobject entry-ID tracking (go_entry) for Goblin Brainwashing
Device (1000333) with INV_Gizmo_01 icon. Extend TypeMapping to 3-way
enum (npc_flag, go_type, go_entry). Override Field Repair Bot 75B
(50041) to match reagent vendor filters despite having no subname.
2026-03-08 09:16:25 -07:00
MarcelineVQ de908eb64f Add vendor subcategories with locale-aware filtering and ammo tracking
Heap-allocated pipe-delimited subname filters for vendor subcategories:
Poison, Reagent, Trade Goods, Ammunition — each with 6-locale support.
Fix same-priority same-flag classification to first-match-wins ordering.
Rename Vendor to General Vendor, fix Reagent icon path to Reagents.blp.
2026-03-08 09:01:27 -07:00
MarcelineVQ 1b9396f8dc Add subname-based NPC classification for minimap tracking
Read creature subname/title from the creature cache (obj+0xB30 → entry+0x10)
to distinguish NPC subtypes sharing the same flag. SetObjectTypeBlip now
accepts include and exclude subname filters (args 4 and 5).

Class Trainer filters by player class name (e.g. "Druid"), Profession
Trainer excludes the player class. Entries with include filters take
priority over exclude-only, which take priority over unfiltered catch-all.
Consolidate vendor subcategories into single Vendor entry.
2026-03-07 21:23:34 -08:00
MarcelineVQ 89b6082d73 Add DLL-side minimap NPC tracking with blip rendering
Hook ObjectEnumProc, RenderObjectBlips, and EnumVisibleObjects to classify
visible objects by NPC flags / GO type and render custom blip icons.

Includes Lua API (SetObjectTypeBlip), texture caching, WMO indoor/outdoor
filtering, and coordinate projection. Consolidate vendor subcategories
into single entry since vanilla only has one NPC_FLAG_VENDOR. Spell
tracking entries now toggle off when clicked while active.

Fix: queryMapObjIDs was __fastcall (not __thiscall) — pushing 3 stack
args but RET 0x8 only cleaned 2, corrupting ESP and crashing.
2026-03-07 20:29:09 -08:00
MarcelineVQ 44f13c42f4 Fix tooltip: hide on dropdown open, conditional cancel hint 2026-03-07 17:28:17 -08:00
MarcelineVQ 528df27780 Add minimap tracking dropdown with Wrath-style NPC icons
Take over native MiniMapTrackingFrame to show a tracking spell
dropdown (Hunter Track X, Sense Undead/Demons, Find Herbs/Minerals)
plus NPC tracking categories with icons extracted from the 3.3.5
client (Auctioneer, Flight Master, Mailbox, Repair, etc.).
2026-03-07 17:20:43 -08:00
MarcelineVQ 5689349158 Remove XYZ debug model assets 2026-03-07 14:27:56 -08:00
MarcelineVQ f836850768 Separate UI feedback from public Lua API
Public functions (WorldMarker, ClearWorldMarker) no longer show chat
messages — return values indicate status. New WorldMarkers.UI_WorldMarker
and UI_ClearWorldMarker wrappers provide user-facing feedback for
slash commands and keybindings. Update README with new API signatures.
2026-03-07 14:23:52 -08:00
MarcelineVQ 9d51ff1c77 Rename sync functions and drop redundant GetMarkerDef
Rename SetMarkerDef → SetMarkerSync, ClearMarkerDef → ClearMarkerSync
to clarify their purpose. Remove GetMarkerDef from the table since
GetWorldMarker is now a public global.
2026-03-07 14:13:41 -08:00
MarcelineVQ 1e8091fcb5 Add GetWorldMarker, return position from WorldMarker, rename CanSetWorldMarker
- WorldMarker() now returns x,y,z,areaId on success (was just 1)
- New global GetWorldMarker(index) for querying marker positions
- Rename CanSetWorldMarkers → CanSetWorldMarker (singular)
- Addon uses WorldMarker return values directly instead of GetMarkerDef
2026-03-07 14:10:22 -08:00
MarcelineVQ 4f195c248f Auto-embed addon and asset files at compile time
build.zig scans module addon/ and assets/ directories, passes file
lists as build options. main.zig uses comptime helpers to @embedFile
each path and build the AddonPrefix table automatically. Adding or
removing files no longer requires editing main.zig.

Also renames markers addon files to match WoW addon name
(Markers.toc → WorldMarkers.toc, Markers.lua → WorldMarkers.lua)
and auto-generates loadAddonsDetour from the same module metadata.
2026-03-07 13:13:49 -08:00
MarcelineVQ edf0be9dbb Distinguish placement failure from permission denied in WorldMarker
DLL now returns -1 for placement failures (no terrain, unit not found)
instead of nil. Lua side shows a throttled (2s cooldown) failure message
separate from the permission denied message.
2026-03-07 11:27:14 -08:00
MarcelineVQ 686d4bada0 Clean up module addons: remove logging, announcements, screenshot bindings
- Screenshot: remove Bindings.xml and login announcement, keep /ss commands
- Interact: reduce to just binding header setup
- Markers: remove all log() debug calls and login announcement
2026-03-07 11:22:18 -08:00
MarcelineVQ 6266d6ff10 Remove core addon, it only contained test functions
The WeirdUtils core addon only provided /wu slash commands, a version
global, and a test function. Remove it along with the WeirdUtils
dependency from all module addon TOC files -- the DLL controls addon
load order directly so the dependency was cosmetic.
2026-03-07 11:11:49 -08:00
MarcelineVQ 23e44cd2a4 Move log path update from core addon to logsessions addon
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.
2026-03-07 10:58:24 -08:00
MarcelineVQ 0f59db18e8 Fix marker position snapping to terrain chunk grid
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.
2026-03-07 10:42:01 -08:00
MarcelineVQ 97844cce8c Update M2 marker assets and DLL_README documentation
Update Raid_UI_FX M2 models. Add bigcursor Lua API docs
(SetCursorScale/GetCursorScale), clean up module control API wording.
2026-03-07 10:28:25 -08:00
MarcelineVQ 0e6d479667 Fix marker placement when cursor is over a unit or game object
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.
2026-03-07 09:03:32 -08:00
MarcelineVQ e1aa765d33 Update RELEASING.md: require full module list in release notes 2026-03-06 14:54:37 -08:00
MarcelineVQ 2aaa089c76 Add module control API, bigcursor with fractional scaling, shared mutex
Module control API:
- Three cdecl exports: WeirdUtils_IsModuleActive, WeirdUtils_DisableModule, WeirdUtils_DisableAll
- C header include/weirdutils_api.h for runtime DLL discovery
- All modules gain pub module_name, isActive(), shared mutex via src/mutex.zig
- build.zig refactored to module_list array of ModuleDesc

Bigcursor:
- D3D9 vtable hooks on SetCursorProperties/ShowCursor
- Scale2x/Scale3x pixel-art upscalers in pure Zig (replaces 12K-line hqx C)
- Bilinear resampler for fractional scales (1.0-4.0, default 1.2)
- Win32 cursor via CreateIconIndirect bypasses D3D9 32x32 limit
- FNV-1a hash cache for ~16 cursor bitmaps
- Lua API: SetCursorScale(n) / GetCursorScale()
- CVar cursorScale for Config.wtf persistence (tenths)

Other:
- Add dpslog module stub
- Docs and README updates
2026-03-06 13:27:35 -08:00
MarcelineVQ 0783f3b0dd Remove redundant full variant from all-variants build
weirdutils.dll already serves this purpose.
2026-03-05 11:21:41 -08:00
MarcelineVQ 00749d5745 Add bigcursor module stub, rename combatlog to logsessions, bump session timer to 60min
- New bigcursor module skeleton with build integration and mutex
- Rename combatlog module to logsessions (directory, files, build options,
  imports, console prefixes, mutex name, DLL variant, docs)
- Increase log session continuation threshold from 30 to 60 minutes
- Update DLL_README log sessions section
2026-03-04 15:14:04 -08:00
MarcelineVQ 1bbf334958 Add GetCombatLogPath/GetChatLogPath Lua functions, update log path globals
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.
2026-03-04 14:39:58 -08:00
MarcelineVQ 0c76c99734 Update DLL_README for per-character log dirs, drop PID from filenames 2026-03-04 14:06:08 -08:00
MarcelineVQ ddd4c9681d Add session markers for chat and raw combat logs
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.
2026-03-04 14:01:29 -08:00
MarcelineVQ 5768c50868 Hook HandleCharacterSelection to set up log paths before world loading
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.
2026-03-04 13:55:24 -08:00
MarcelineVQ 97307aa79f Per-character log directories with session continuation and chat log redirect
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.
2026-03-04 13:39:41 -08:00
MarcelineVQ 12db928365 Hook InitializeLogBuffer to redirect combat log paths from any caller
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.
2026-03-04 08:44:40 -08:00
MarcelineVQ f139480590 Remove SD message and consolidate sync timer into single frame
SD was unnecessary since the 5s fallback timer already clears sync
state. Also disabled debug logging in the addon.
2026-03-04 08:44:21 -08:00
MarcelineVQ 38e5872591 Unify marker sync protocol: remove SetMarkerDefSync, use SF/SD messages
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.
2026-03-03 18:52:28 -08:00
MarcelineVQ 11851c4ece Hook WriteFormattedLogMessage to inject session marker before first combat log write
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.
2026-03-03 17:38:25 -08:00
MarcelineVQ 049f6cd851 Use name cache for combatlog player name, remove SignalEvent probe
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.
2026-03-03 15:13:14 -08:00
MarcelineVQ 11030e0566 Fix WriteFormattedLogMessage: stdcall with va_list, not cdecl variadic
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.
2026-03-03 14:53:32 -08:00
MarcelineVQ aa6ea3c558 Fix combatlog player name resolution: stdcall ABI for GetObjectPtr
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.
2026-03-03 14:22:56 -08:00
MarcelineVQ 4af033d01d Rename dataassets→customassets, Markers→WorldMarkers, prefix all mutexes
- 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
2026-03-03 10:26:17 -08:00
MarcelineVQ c00ea75d59 Rename looseassets module to dataassets 2026-03-02 23:55:26 -08:00
MarcelineVQ c04680788d Fix release-mode crashes: inline asm register clobbers and fastcall ABI
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()
2026-03-02 23:38:04 -08:00
MarcelineVQ b69c3a55a1 Move permission checks DLL-side: canSetMarkers, senderHasPermission, senderInGroup
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.
2026-03-02 21:46:42 -08:00
MarcelineVQ 0c2b038e45 Add DLL-side permission gate and return values for WorldMarker/ClearWorldMarker
- WorldMarker/ClearWorldMarker now return 1 on success, nil on permission denied
- LuaCFn calling convention fixed to x86_fastcall (matches WoW Lua C functions)
- ClearWorldMarker handles nil arg (clear all) via lua_type check
- Addon wraps DLL functions: shows deny message on nil return, broadcasts on success
- Permission denial feedback with cooldown (5s) and max 3 messages per login
- Removed redundant canSetMarkers() Lua-side check from broadcast path
2026-03-02 20:59:55 -08:00
MarcelineVQ 3c15c8650a Extract shared lua.zig and add DLL-side marker permission check
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).
2026-03-02 12:59:38 -08:00
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