mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-07 02:40:30 -05:00
Fixed Gyroscopy Settings & Drift
This commit is contained in:
parent
d0c5e7aa0e
commit
c99f10169e
@ -198,7 +198,7 @@ namespace Ship {
|
|||||||
const int isSpecialController = !strcmp("PS5 Controller", contName);
|
const int isSpecialController = !strcmp("PS5 Controller", contName);
|
||||||
float gyro_drift_x = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroDriftX", contNumber).c_str(), 0.0f);
|
float gyro_drift_x = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroDriftX", contNumber).c_str(), 0.0f);
|
||||||
float gyro_drift_y = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroDriftY", contNumber).c_str(), 0.0f);
|
float gyro_drift_y = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroDriftY", contNumber).c_str(), 0.0f);
|
||||||
const float gyro_sensitivity = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroSensitivity").c_str(), 1.0f);
|
const float gyro_sensitivity = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroSensitivity", contNumber).c_str(), 1.0f);
|
||||||
|
|
||||||
if (gyro_drift_x == 0) {
|
if (gyro_drift_x == 0) {
|
||||||
gyro_drift_x = gyroData[0];
|
gyro_drift_x = gyroData[0];
|
||||||
|
@ -310,6 +310,13 @@ namespace SohImGui {
|
|||||||
LoadTexture("C-Down", "assets/ship_of_harkinian/buttons/CDown.png");
|
LoadTexture("C-Down", "assets/ship_of_harkinian/buttons/CDown.png");
|
||||||
} });
|
} });
|
||||||
|
|
||||||
|
for (const auto& [i, controllers] : Ship::Window::Controllers)
|
||||||
|
{
|
||||||
|
CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftX", i).c_str(), 0);
|
||||||
|
CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftY", i).c_str(), 0);
|
||||||
|
needs_save = true;
|
||||||
|
}
|
||||||
|
|
||||||
ModInternal::registerHookListener({ CONTROLLER_READ, [](const HookEvent ev) {
|
ModInternal::registerHookListener({ CONTROLLER_READ, [](const HookEvent ev) {
|
||||||
pads = static_cast<OSContPad*>(ev->baseArgs["cont_pad"]);
|
pads = static_cast<OSContPad*>(ev->baseArgs["cont_pad"]);
|
||||||
} });
|
} });
|
||||||
@ -509,8 +516,8 @@ namespace SohImGui {
|
|||||||
|
|
||||||
if (ImGui::Button("Recalibrate Gyro"))
|
if (ImGui::Button("Recalibrate Gyro"))
|
||||||
{
|
{
|
||||||
CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftX").c_str(), 0);
|
CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftX", i).c_str(), 0);
|
||||||
CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftY").c_str(), 0);
|
CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftY", i).c_str(), 0);
|
||||||
needs_save = true;
|
needs_save = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user