mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 08:00:42 +00:00
Chasing four cvars that ConsoleGetAllCommands reported but GetCVar raised on turned up the mechanism behind both. FUN_FIND_CVAR is not a plain by-name lookup. After matching it tests `if (-1 < (int)flags) return 0` -- the flags read as SIGNED, so it returns only cvars with bit 31 set. GetCVar, SetCVar and C_CVar.* all go through it, so a cvar without that bit cannot be reached from Lua at all. FUN_0063DE30 is the same hash walk without the test. Bit 31 is set when the registrar's registerConsole argument is 0, and the config loader FUN_0063D820 runs each `SET` line in Config.wtf as a console command, whose handler FUN_0063D500 registers an unknown name as a fresh cvar with registerConsole = 1 and flags 0 -- into which the registrar ORs the archive bit, so the config writer saves it straight back out. So any line left in Config.wtf becomes a cvar on the next boot whether or not the client implements a setting by that name: preserved across sessions, writable from the console, invisible to Lua. realmlist.wtf runs through the same path, so a line there materialises in Config.wtf too. Nothing to fix. C_CVar.GetCVarInfo already uses the filtering lookup, so it returns nil exactly where GetCVar and SetCVar do and the Lua cvar surface agrees with itself, while ConsoleGetAllCommands lists these because the console genuinely can reach them. Both functions were already right; only the reason was unrecorded.