-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Is there an existing issue for this?
- I have searched the existing issues
Your Question
How can I verify that the recoil correction is working?
Additional details
Hi,
I've successfully built the project and tested it in the game after binding the keys. The Arduino is connected, and everything seems fine on that end. However, I can't tell if the program is actually doing anything — there are no visible signs of it working in-game.
I might be doing something wrong. I bound recoil control to the Shift key, but when I hold it, there's no noticeable difference — the weapon still recoils like normal. I also selected the AK-47 before testing, but that didn't seem to change anything either.
Could you help me figure out what might be going wrong?
I have added some logs :
`
#include "FastReload.h"
#include "RecoilControl.h"
#include "Logger.h"
RecoilControl::RecoilControl(ModuleManager& manager) : manager(manager), weapon(OFF) {
Logger::LogMessage("RecoilControl initialized.");
}
void RecoilControl::Execute(Arduino& arduino, const Config& config)
{
Logger::LogMessage("Execute method called.");
weapon = GetWeaponState(weapon, config);
Logger::LogMessage("Weapon state: " + std::to_string(weapon));
if (weapon == OFF) {
Logger::LogMessage("Weapon is OFF. Exiting Execute method.");
return;
}
double obs = 0.75 / config.GetZoomSensitivity();
double modifier = CalculateModifier(config, obs);
Logger::LogMessage("Modifier calculated: " + std::to_string(modifier));
WeaponData data = GetWeaponData(weapon, modifier);
Logger::LogMessage("Weapon data retrieved.");
if (!ValidateWeaponData(data))
{
Logger::LogMessage("Invalid weapon data. Setting weapon to OFF.");
weapon = OFF;
return;
}
ProcessRecoilData(arduino, config, data);
}
double RecoilControl::CalculateModifier(const Config& config, double obs)
{
Logger::LogMessage("CalculateModifier called.");
double modifier = 2.52 / config.GetSensitivity();
Logger::LogMessage("Base modifier: " + std::to_string(modifier));
if (IsKeyHolded(VK_RBUTTON)) {
modifier *= obs;
Logger::LogMessage("Modifier adjusted for zoom: " + std::to_string(modifier));
}
return modifier;
}
bool RecoilControl::ValidateWeaponData(const WeaponData& data)
{
Logger::LogMessage("ValidateWeaponData called.");
bool isValid = data.x.size() == data.y.size() && data.x.size() == data.delay.size();
Logger::LogMessage("Weapon data validation result: " + std::to_string(isValid));
return isValid;
}
void RecoilControl::ProcessRecoilData(Arduino& arduino, const Config& config, const WeaponData& data)
{
Logger::LogMessage("ProcessRecoilData called.");
for (size_t i = 0; i < data.x.size(); i++)
{
if (!IsKeyHolded(VK_LBUTTON) || (config.GetConfirmationKey() != 0 && !IsKeyHolded(config.GetConfirmationKey())))
{
Logger::LogMessage("Key not held. Exiting ProcessRecoilData.");
return;
}
Logger::LogMessage("Sending recoil data: x=" + std::to_string(data.x[i]) + ", y=" + std::to_string(data.y[i]) + ", delay=" + std::to_string(data.delay[i]));
arduino.WriteMessage("MOUSE_LEFT_HOLDED:" + std::to_string(data.x[i]) + "," + std::to_string(data.y[i]) + "," + std::to_string(data.delay[i]));
sleep_for(milliseconds(data.delay[i]));
}
Logger::LogMessage("Recoil data processing complete. Sending MOUSE_LEFT_CLICK.");
arduino.WriteMessage("MOUSE_LEFT_CLICK");
if (auto* fastReload = manager.GetModule<FastReload>("FastReload"))
{
Logger::LogMessage("FastReload module found. Processing.");
fastReload->SetCurrentWeapon(weapon);
fastReload->Process(arduino, config);
}
}
`
Now I’m getting the following logs:
[08.05.2025 17:19:11] [info] Weapon state: 0
[08.05.2025 17:19:11] [info] Weapon is OFF. Exiting Execute method.
[08.05.2025 17:19:11] [info] Execute method called.
Why is this happening? I selected the AK-47, which is bound to Numpad 3. I also tried the default configuration using the F-keys, but the result is the same — no matter what key I press, it doesn’t seem to register.