mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-13 06:38:57 +00:00
CVar::Factory::Register now takes a help line and a console category. The registrar's EDX slot is the help line, not a spare zero, and category 9 (what Script_RegisterCVar passes) matches none of the nine console categories. So our cvars had no help and were listed under no category in `help <category>`. Every backported cvar now passes retail's exact help string and category (from Ketho's C_Console.GetAllCommands dump). The bag-sort and TTS cvars have no retail counterpart and get no help line. GetInt and the new GetFloat read the integer and float the setter stores on every change, as the engine's own readers do. They no longer re-parse the string. SoftTarget's atof copy and Nearest's raw read are gone. Info, Bool, Set and Bitfield now go through the Factory (Find, GetString, the new IsReadOnly) instead of their own lookups and field reads. The read-only bit on scriptMemory is no longer a mystery. FUN_0063E030 sets it on realmList, realmName and scriptMemory from CGGameUI::InitializeGame, before the interface loads, and ShutdownGame clears it. So CVar::ScriptMemory's in-game hook could never write. Drop it and keep the glue one. Also correct the Offsets.h comments: FUN_SET_CVAR_VALUE is __thiscall, and the registrar's callback contract is now documented.
38 lines
1.4 KiB
C++
38 lines
1.4 KiB
C++
// 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 <https://www.gnu.org/licenses/>.
|
|
|
|
// The `ActionButtonUseKeyDown` cvar — registered by 4.3.4's engine
|
|
// (GameUI_CVar.cpp, "Activate the action button on a keydown") and read only
|
|
// by FrameXML's action-button key handlers, which this project's addon ports
|
|
// (Util/ActionButton.lua). The engine half is the registration. The default
|
|
// is 0, keeping 1.12's action buttons firing on key release; 4.3.4 shipped 1.
|
|
|
|
#include "Game.h"
|
|
#include "Offsets.h"
|
|
#include "cvar/Factory.h"
|
|
|
|
namespace Action::UseKeyDown {
|
|
|
|
namespace {
|
|
|
|
void Register() {
|
|
CVar::Factory::Register("ActionButtonUseKeyDown", "Activate the action button on a keydown",
|
|
Offsets::CVAR_CATEGORY_GAME, "0");
|
|
}
|
|
|
|
const Game::ModuleAutoRegister _autoreg{&Register};
|
|
|
|
} // namespace
|
|
|
|
} // namespace Action::UseKeyDown
|