USB: Properly initialise effect unions (C rules gotcha)

This commit is contained in:
refractionpcsx2 2023-06-10 12:21:32 +01:00
parent a979d2283f
commit c679de8e39
2 changed files with 8 additions and 4 deletions

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()

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;