USB: Properly initialise effect unions (C rules gotcha)

This commit is contained in:
refractionpcsx2 committed 2023-06-10 13:10:58 +01:00
1 parent a979d2283f
commit c679de8e39
2 files changed
+8 -4

No files matched your search

+4
View File
@@ -31,6 +31,10 @@ namespace usb_pad
SDLFFDevice::SDLFFDevice(SDL_Haptic* haptic)
: m_haptic(haptic)
{
std::memset(&m_constant_effect, 0, sizeof(m_constant_effect));
std::memset(&m_spring_effect, 0, sizeof(m_spring_effect));
std::memset(&m_damper_effect, 0, sizeof(m_damper_effect));
std::memset(&m_friction_effect, 0, sizeof(m_friction_effect));
}
SDLFFDevice::~SDLFFDevice()
+4 -4
View File
@@ -45,19 +45,19 @@ namespace usb_pad
SDL_Haptic* m_haptic = nullptr;
SDL_HapticEffect m_constant_effect = {};
SDL_HapticEffect m_constant_effect;
int m_constant_effect_id = -1;
bool m_constant_effect_running = false;
SDL_HapticEffect m_spring_effect = {};
SDL_HapticEffect m_spring_effect;
int m_spring_effect_id = -1;
bool m_spring_effect_running = false;
SDL_HapticEffect m_damper_effect = {};
SDL_HapticEffect m_damper_effect;
int m_damper_effect_id = -1;
bool m_damper_effect_running = false;
SDL_HapticEffect m_friction_effect = {};
SDL_HapticEffect m_friction_effect;
int m_friction_effect_id = -1;
bool m_friction_effect_running = false;