Skip to content

Commit 62f89f6

Browse files
committed
Fix formatting and minor code style issues
This commit corrects indentation, whitespace, and code style inconsistencies across several files, including lambda formatting, include order, and brace placement. It also fixes minor typos and improves code readability without changing logic or functionality.
1 parent d7b483e commit 62f89f6

8 files changed

Lines changed: 72 additions & 72 deletions

File tree

Source/Private/GCore/Interfaces/IPlatformHardwareInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
#include "GCore/Interfaces/IPlatformHardwareInfo.h"
77

88
std::unique_ptr<IPlatformHardwareInfo>
9-
IPlatformHardwareInfo::PlatformInfoInstance = nullptr;
9+
IPlatformHardwareInfo::PlatformInfoInstance = nullptr;
1010

1111
IPlatformHardwareInfo& IPlatformHardwareInfo::Get()
1212
{
1313
return *PlatformInfoInstance;
1414
}
1515

1616
void IPlatformHardwareInfo::SetInstance(
17-
std::unique_ptr<IPlatformHardwareInfo> InPlatform)
17+
std::unique_ptr<IPlatformHardwareInfo> InPlatform)
1818
{
1919
PlatformInfoInstance = std::move(InPlatform);
2020
}

Source/Private/GImplementations/Libraries/DualSense/DualSenseLibrary.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
// Targets: Windows, Linux, macOS.
55

66
#include "GImplementations/Libraries/DualSense/DualSenseLibrary.h"
7-
8-
#include <thread>
9-
107
#include "GCore/Interfaces/IPlatformHardwareInfo.h"
118
#include "GCore/Types/ECoreGamepad.h"
129
#include "GCore/Types/Structs/Context/DeviceContext.h"
@@ -15,6 +12,7 @@
1512
#include "GImplementations/Utils/GamepadSensors.h"
1613
#include "GImplementations/Utils/GamepadTouch.h"
1714
#include "GImplementations/Utils/GamepadTrigger.h"
15+
#include <thread>
1816

1917
using namespace FDualSenseTriggerComposer;
2018

@@ -134,7 +132,7 @@ void FDualSenseLibrary::UpdateInput(float Delta)
134132
DSCoreTypes::DSVector3D AccelG;
135133

136134
using namespace FGamepadSensors;
137-
ProcessMotionData(&Context->Buffer[Padding], Context->Calibration, GyroDeg,AccelG);
135+
ProcessMotionData(&Context->Buffer[Padding], Context->Calibration, GyroDeg, AccelG);
138136

139137
InputToFill->Gyroscope = GyroDeg;
140138
InputToFill->Accelerometer = AccelG;

Source/Public/GCore/Templates/TBasicDeviceRegistry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace GamepadCore
2828
{
2929
t.DispatchNewGamepad(std::declval<typename T::EngineIdType>())
3030
} -> std::same_as<void>;
31-
};
31+
}
3232

3333
template<typename DeviceRegistryPolicy>
3434
class TBasicDeviceRegistry : public IDeviceRegistry

Source/Public/GCore/Templates/TGenericHardwareInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace GamepadCore
2929
{
3030
t.ProcessAudioHaptic(ctx)
3131
} -> std::same_as<void>;
32-
};
32+
}
3333

3434
template<typename THardwarePolicy>
3535
class TGenericHardwareInfo : public IPlatformHardwareInfo

Source/Public/GCore/Types/Structs/Context/OutputContext.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
// Targets: Windows, Linux, macOS.
55

66
#pragma once
7-
#include "GCore/Types/Structs/Config/GamepadAudio.h"
8-
#include "GCore/Types/Structs/Config/GamepadFeature.h"
97
#include "../Config/GamepadLightbar.h"
10-
#include "GCore/Types/Structs/Config/GamepadLigthbarFlash.h"
118
#include "../Config/GamepadPlayerLed.h"
129
#include "../Config/GamepadRumbles.h"
10+
#include "GCore/Types/Structs/Config/GamepadAudio.h"
11+
#include "GCore/Types/Structs/Config/GamepadFeature.h"
12+
#include "GCore/Types/Structs/Config/GamepadLigthbarFlash.h"
1313
#include "GCore/Types/Structs/Config/GamepadTriggersHaptic.h"
1414

1515
/**

Source/Public/GImplementations/Libraries/Base/SonyGamepadAbstract.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ class SonyGamepadAbstract : public ISonyGamepad
167167
*/
168168
void SetVibration(std::uint8_t LeftRumble, std::uint8_t RightRumble) override {}
169169

170-
SonyGamepadAbstract() : HIDDeviceContexts() {}
170+
SonyGamepadAbstract()
171+
: HIDDeviceContexts()
172+
{}
171173

172174
protected:
173175
/**

Source/Public/GImplementations/Libraries/DualSense/DualSenseLibrary.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ class FDualSenseLibrary : public SonyGamepadAbstract,
362362
* @param Color The desired color of the lightbar, represented as an FDSColor
363363
*/
364364
virtual void SetLightbar(DSCoreTypes::FDSColor Color) override;
365-
virtual void SetLightbarFlash(DSCoreTypes::FDSColor Color, float BrithnessTime, float ToggleTime) override {};
365+
virtual void SetLightbarFlash(DSCoreTypes::FDSColor Color, float BrithnessTime, float ToggleTime) override {}
366366
/**
367367
* @brief Updates the haptic feedback system of the DualSense controller with
368368
* audio data.

Source/Public/GImplementations/Utils/GamepadSensors.h

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -11,65 +11,65 @@ namespace FGamepadSensors
1111
FGamepadCalibration& OutCalibration)
1212
{
1313
auto GetLE16 = [](const std::uint8_t* Data) -> std::int16_t {
14-
return static_cast<std::int16_t>(Data[0] | (Data[1] << 8));
15-
};
16-
17-
// Todos agora são int16_t
18-
const std::int16_t GyroPitchBias = GetLE16(&Buffer[1]);
19-
const std::int16_t GyroYawBias = GetLE16(&Buffer[3]);
20-
const std::int16_t GyroRollBias = GetLE16(&Buffer[5]);
21-
22-
const std::int16_t GyroPitchPlus = GetLE16(&Buffer[7]);
23-
const std::int16_t GyroPitchMinus = GetLE16(&Buffer[9]);
24-
const std::int16_t GyroYawPlus = GetLE16(&Buffer[11]);
25-
const std::int16_t GyroYawMinus = GetLE16(&Buffer[13]);
26-
const std::int16_t GyroRollPlus = GetLE16(&Buffer[15]);
27-
const std::int16_t GyroRollMinus = GetLE16(&Buffer[17]);
28-
29-
const std::int16_t GyroSpeedPlus = GetLE16(&Buffer[19]);
30-
const std::int16_t GyroSpeedMinus = GetLE16(&Buffer[21]);
31-
32-
const std::int16_t AccelXPlus = GetLE16(&Buffer[23]);
33-
const std::int16_t AccelXMinus = GetLE16(&Buffer[25]);
34-
const std::int16_t AccelYPlus = GetLE16(&Buffer[27]);
35-
const std::int16_t AccelYMinus = GetLE16(&Buffer[29]);
36-
const std::int16_t AccelZPlus = GetLE16(&Buffer[31]);
37-
const std::int16_t AccelZMinus = GetLE16(&Buffer[33]);
38-
39-
// Gyro Biases (Cuidado: Você tinha código duplicado aqui, limpei)
40-
OutCalibration.GyroBiasX = static_cast<float>(GyroPitchBias);
41-
OutCalibration.GyroBiasY = static_cast<float>(GyroYawBias);
42-
OutCalibration.GyroBiasZ = static_cast<float>(GyroRollBias);
43-
44-
// Fatores do Gyro
45-
// Usamos float para garantir precisão na soma antes da divisão
46-
const float Speed2x = static_cast<float>(GyroSpeedPlus + GyroSpeedMinus);
47-
48-
// A logica ABS funciona melhor agora que são int16
49-
float DenomX = static_cast<float>(std::abs(GyroPitchPlus - GyroPitchBias) + std::abs(GyroPitchMinus - GyroPitchBias));
50-
OutCalibration.GyroFactorX = (DenomX != 0.0f) ? (Speed2x / DenomX) : 1.0f;
51-
52-
float DenomY = static_cast<float>(std::abs(GyroYawPlus - GyroYawBias) + std::abs(GyroYawMinus - GyroYawBias));
53-
OutCalibration.GyroFactorY = (DenomY != 0.0f) ? (Speed2x / DenomY) : 1.0f;
54-
55-
float DenomZ = static_cast<float>(std::abs(GyroRollPlus - GyroRollBias) + std::abs(GyroRollMinus - GyroRollBias));
56-
OutCalibration.GyroFactorZ = (DenomZ != 0.0f) ? (Speed2x / DenomZ) : 1.0f;
57-
58-
// Acc X
59-
// IMPORTANTE: Agora (XPlus - XMinus) fará a conta correta: ex: 8192 - (-8192) = 16384
60-
const float RangeX = static_cast<float>(AccelXPlus - AccelXMinus);
61-
OutCalibration.AccelBiasX = (AccelXPlus + AccelXMinus) / 2.0f; // Bias agora será próximo de 0
62-
OutCalibration.AccelFactorX = (RangeX != 0.0f) ? (2.0f / RangeX) : 1.0f;
63-
64-
// Acc Y
65-
const float RangeY = static_cast<float>(AccelYPlus - AccelYMinus);
66-
OutCalibration.AccelBiasY = (AccelYPlus + AccelYMinus) / 2.0f;
67-
OutCalibration.AccelFactorY = (RangeY != 0.0f) ? (2.0f / RangeY) : 1.0f;
68-
69-
// Acc Z
70-
const float RangeZ = static_cast<float>(AccelZPlus - AccelZMinus);
71-
OutCalibration.AccelBiasZ = (AccelZPlus + AccelZMinus) / 2.0f;
72-
OutCalibration.AccelFactorZ = (RangeZ != 0.0f) ? (2.0f / RangeZ) : 1.0f;
14+
return static_cast<std::int16_t>(Data[0] | (Data[1] << 8));
15+
};
16+
17+
// Todos agora são int16_t
18+
const std::int16_t GyroPitchBias = GetLE16(&Buffer[1]);
19+
const std::int16_t GyroYawBias = GetLE16(&Buffer[3]);
20+
const std::int16_t GyroRollBias = GetLE16(&Buffer[5]);
21+
22+
const std::int16_t GyroPitchPlus = GetLE16(&Buffer[7]);
23+
const std::int16_t GyroPitchMinus = GetLE16(&Buffer[9]);
24+
const std::int16_t GyroYawPlus = GetLE16(&Buffer[11]);
25+
const std::int16_t GyroYawMinus = GetLE16(&Buffer[13]);
26+
const std::int16_t GyroRollPlus = GetLE16(&Buffer[15]);
27+
const std::int16_t GyroRollMinus = GetLE16(&Buffer[17]);
28+
29+
const std::int16_t GyroSpeedPlus = GetLE16(&Buffer[19]);
30+
const std::int16_t GyroSpeedMinus = GetLE16(&Buffer[21]);
31+
32+
const std::int16_t AccelXPlus = GetLE16(&Buffer[23]);
33+
const std::int16_t AccelXMinus = GetLE16(&Buffer[25]);
34+
const std::int16_t AccelYPlus = GetLE16(&Buffer[27]);
35+
const std::int16_t AccelYMinus = GetLE16(&Buffer[29]);
36+
const std::int16_t AccelZPlus = GetLE16(&Buffer[31]);
37+
const std::int16_t AccelZMinus = GetLE16(&Buffer[33]);
38+
39+
// Gyro Biases (Cuidado: Você tinha código duplicado aqui, limpei)
40+
OutCalibration.GyroBiasX = static_cast<float>(GyroPitchBias);
41+
OutCalibration.GyroBiasY = static_cast<float>(GyroYawBias);
42+
OutCalibration.GyroBiasZ = static_cast<float>(GyroRollBias);
43+
44+
// Fatores do Gyro
45+
// Usamos float para garantir precisão na soma antes da divisão
46+
const float Speed2x = static_cast<float>(GyroSpeedPlus + GyroSpeedMinus);
47+
48+
// A logica ABS funciona melhor agora que são int16
49+
float DenomX = static_cast<float>(std::abs(GyroPitchPlus - GyroPitchBias) + std::abs(GyroPitchMinus - GyroPitchBias));
50+
OutCalibration.GyroFactorX = (DenomX != 0.0f) ? (Speed2x / DenomX) : 1.0f;
51+
52+
float DenomY = static_cast<float>(std::abs(GyroYawPlus - GyroYawBias) + std::abs(GyroYawMinus - GyroYawBias));
53+
OutCalibration.GyroFactorY = (DenomY != 0.0f) ? (Speed2x / DenomY) : 1.0f;
54+
55+
float DenomZ = static_cast<float>(std::abs(GyroRollPlus - GyroRollBias) + std::abs(GyroRollMinus - GyroRollBias));
56+
OutCalibration.GyroFactorZ = (DenomZ != 0.0f) ? (Speed2x / DenomZ) : 1.0f;
57+
58+
// Acc X
59+
// IMPORTANTE: Agora (XPlus - XMinus) fará a conta correta: ex: 8192 - (-8192) = 16384
60+
const float RangeX = static_cast<float>(AccelXPlus - AccelXMinus);
61+
OutCalibration.AccelBiasX = (AccelXPlus + AccelXMinus) / 2.0f; // Bias agora será próximo de 0
62+
OutCalibration.AccelFactorX = (RangeX != 0.0f) ? (2.0f / RangeX) : 1.0f;
63+
64+
// Acc Y
65+
const float RangeY = static_cast<float>(AccelYPlus - AccelYMinus);
66+
OutCalibration.AccelBiasY = (AccelYPlus + AccelYMinus) / 2.0f;
67+
OutCalibration.AccelFactorY = (RangeY != 0.0f) ? (2.0f / RangeY) : 1.0f;
68+
69+
// Acc Z
70+
const float RangeZ = static_cast<float>(AccelZPlus - AccelZMinus);
71+
OutCalibration.AccelBiasZ = (AccelZPlus + AccelZMinus) / 2.0f;
72+
OutCalibration.AccelFactorZ = (RangeZ != 0.0f) ? (2.0f / RangeZ) : 1.0f;
7373
}
7474

7575
inline void ProcessMotionData(const std::uint8_t* Buffer,

0 commit comments

Comments
 (0)