Files
wowdecomp/WoW/Source/UIUtil/InputControl_CVar.cpp
SatyandClaude Opus 5.5 2e418f9e08 Client bring-up: glue screen, EULA/TOS, shutdown chain, LCD, x64 fixes
- Stand-in client reaches the glue screens (intro movie, EULA/TOS accept,
  login screen) at 16:9; stand-ins are report-only on x64
- Ports on the startup/idle path: GlueScriptEvents/CharacterSelection/
  CharacterCreation/RealmList/AccountMsg/VideoOptions _Scripts, CGlueMgr
  (Initialize/Resume/Idle/Accept*/Shutdown), ClientServices, NetClient/
  WowConnection, DBCache + instances, WorldParam/World/Map/Liquid/Weather/
  shadow, InputControl, Scrn, ConsoleClient, SysMessage, LoadingScreen,
  SystemRegisterFunctions, CGameTime, Screen::GetAspectRatio
- Shutdown chain: BeginCloseGame, DestroyEngineCallback, DBCache save/
  destroy, SpellVisuals/Effect/World/Glue teardown
- Logitech LCD no-device path in Ui/UILCD/Windows (Windows-only dir);
  lgLcd is a stub library in ThirdParty/lgLcd
- CVar and console commands split into <Module>_CVar.cpp / _Console.cpp
- DivxDecoder.dll (Win32, original) and XvidDecoder.dll (x64, port with
  vendored xvidcore) both copied to the build folder
- Warden: Win32 faithful port, Win64 stub
- x64 fixes: lua_newstate gcusage/gctime init, pointer render states reset
  with nullptr, g_rndSeed defined
- 37 class/struct forward-declaration mismatches fixed (false stand-ins)

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-27 21:47:34 +02:00

154 lines
4.1 KiB
C++

#include <cstdint>
#include "Engine/Source/ConsoleBase/ConsoleVar.h"
#include "Engine/Source/ConsoleBase/IConsole.h"
#include "Engine/Source/FrameXML/LoadXML.h"
#include "Engine/Source/FrameXML/XMLTree.h"
#include "Engine/Source/Os/Joystick.h"
#include "Engine/Source/Storm/H/storm.h"
#include "WoW/Source/UIUtil/InputControl.h"
// STATIC: 0x00C2495C
CVar* s_cvCinematicJoystick;
// STATIC: 0x00C24960
CVar* s_cvEnableWowMouse;
// VERIFY: a786a3e1 manual
// OFFSET: 0x005F99F0
static void ApplyJoystickConfig(XMLNode* config) {
char name[32];
for (XMLNode* child = config->m_child; child; child = child->m_next) {
if (!SStrCmpI(child->m_name.m_str, "stick", STORM_MAX_STR)) {
int32_t stick = 0;
int32_t xAxis = 0;
int32_t yAxis = 1;
const char* value = child->GetAttributeByName("index");
if (value) {
stick = SStrToInt(value) - 1;
}
value = child->GetAttributeByName("axisX");
if (value) {
xAxis = SStrToInt(value) - 1;
}
value = child->GetAttributeByName("axisY");
if (value) {
yAxis = SStrToInt(value) - 1;
}
OsJoystickMapStick(s_joystick, stick, xAxis, yAxis);
} else if (!SStrCmpI(child->m_name.m_str, "slider", STORM_MAX_STR)) {
const char* value = child->GetAttributeByName("axis");
if (value) {
OsJoystickMapSlider(s_joystick, SStrToInt(value) - 1);
}
} else if (!SStrCmpI(child->m_name.m_str, "hat", STORM_MAX_STR)) {
int32_t hat = 0;
int32_t buttons[4] = { -1, -1, -1, -1 };
const char* value = child->GetAttributeByName("index");
if (value) {
hat = SStrToInt(value) - 1;
}
for (uint32_t i = 0; i < 4; i++) {
SStrPrintf(name, sizeof(name), "button%d", i + 1);
value = child->GetAttributeByName(name);
if (value) {
buttons[i] = SStrToInt(value) - 1;
}
}
OsJoystickMapHat(s_joystick, hat, buttons[0], buttons[1], buttons[2], buttons[3]);
}
}
XMLNode* mouse = config->GetChildByName("mouse");
if (!mouse) {
return;
}
const char* value = mouse->GetAttributeByName("enabled");
if (value) {
s_joystickMouseEnabled = StringToBOOL(value);
}
if (!s_joystickMouseEnabled) {
return;
}
float speed = 1.5f;
int32_t stick = 0;
int32_t leftButton = 0;
int32_t rightButton = 1;
value = mouse->GetAttributeByName("stickIndex");
if (value) {
stick = SStrToInt(value) - 1;
}
value = mouse->GetAttributeByName("buttonLeft");
if (value) {
leftButton = SStrToInt(value) - 1;
}
value = mouse->GetAttributeByName("buttonRight");
if (value) {
rightButton = SStrToInt(value) - 1;
}
value = mouse->GetAttributeByName("speedScale");
OsJoystickConfigureMouseMode(s_joystick, stick, leftButton, rightButton, value ? SStrToFloat(value) : speed);
}
// VERIFY: ff53c0b8 auto
// OFFSET: 0x005F9C80
bool JoystickCallback(CVar* var, const char* oldValue, const char* value, void* arg) {
if (*value == '1') {
if (s_joystick == 0xFFFFFFFF) {
s_joystick = OsJoystickOpen(0);
if (s_joystick == 0xFFFFFFFF) {
return true;
}
}
char name[1024];
ConsolePrintf("Joystick: %s", OsJoystickGetName(s_joystick, name, sizeof(name)));
XMLNode* config;
XMLTree* tree = LoadJoystickConfig(config);
if (tree) {
ApplyJoystickConfig(config);
XMLTree_Free(tree);
}
} else if (s_joystick != 0xFFFFFFFF) {
OsJoystickClose(s_joystick);
s_joystick = 0xFFFFFFFF;
}
return true;
}
// VERIFY: 0766c614 auto
// OFFSET: 0x005FA9B0
bool WowMouseCVarCallback(CVar* var, const char* oldValue, const char* value, void* arg) {
CGInputControl::s_inputControl->SetMouseCVarHandler((value ? SStrToInt(value) : 0) != 0);
return true;
}