/* controller-haptics.c generated by valac 0.56.19, the Vala compiler
 * generated from controller-haptics.vala, do not modify */

#include "protonplus_core.h"
#include <glib.h>
#include <glib-object.h>
#include <gee.h>
#include <string.h>
#include <SDL3/SDL_gamepad.h>
#include <SDL3/SDL_properties.h>
#include <stdlib.h>
#include <SDL3/SDL_error.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_PULSE_0_PROPERTY,
	PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_PULSE_LOW_FREQUENCY_STRENGTH_PROPERTY,
	PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_PULSE_HIGH_FREQUENCY_STRENGTH_PROPERTY,
	PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_PULSE_DURATION_MS_PROPERTY,
	PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_PULSE_NUM_PROPERTIES
};
static GParamSpec* proton_plus_utils_controller_haptic_pulse_properties[PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_PULSE_NUM_PROPERTIES];
enum  {
	PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_POLICY_0_PROPERTY,
	PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_POLICY_NUM_PROPERTIES
};
static GParamSpec* proton_plus_utils_controller_haptic_policy_properties[PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_POLICY_NUM_PROPERTIES];
enum  {
	PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_FEEDBACK_0_PROPERTY,
	PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_FEEDBACK_NUM_PROPERTIES
};
static GParamSpec* proton_plus_utils_controller_haptic_feedback_properties[PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_FEEDBACK_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define PROTON_PLUS_UTILS_SDL_CONTROLLER_HAPTIC_SINK_TYPE_DEVICE (proton_plus_utils_sdl_controller_haptic_sink_device_get_type ())
#define PROTON_PLUS_UTILS_SDL_CONTROLLER_HAPTIC_SINK_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_UTILS_SDL_CONTROLLER_HAPTIC_SINK_TYPE_DEVICE, ProtonPlusUtilsSdlControllerHapticSinkDevice))
#define PROTON_PLUS_UTILS_SDL_CONTROLLER_HAPTIC_SINK_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_UTILS_SDL_CONTROLLER_HAPTIC_SINK_TYPE_DEVICE, ProtonPlusUtilsSdlControllerHapticSinkDeviceClass))
#define PROTON_PLUS_UTILS_SDL_CONTROLLER_HAPTIC_SINK_IS_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_UTILS_SDL_CONTROLLER_HAPTIC_SINK_TYPE_DEVICE))
#define PROTON_PLUS_UTILS_SDL_CONTROLLER_HAPTIC_SINK_IS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_UTILS_SDL_CONTROLLER_HAPTIC_SINK_TYPE_DEVICE))
#define PROTON_PLUS_UTILS_SDL_CONTROLLER_HAPTIC_SINK_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_UTILS_SDL_CONTROLLER_HAPTIC_SINK_TYPE_DEVICE, ProtonPlusUtilsSdlControllerHapticSinkDeviceClass))

typedef struct _ProtonPlusUtilsSdlControllerHapticSinkDevice ProtonPlusUtilsSdlControllerHapticSinkDevice;
typedef struct _ProtonPlusUtilsSdlControllerHapticSinkDeviceClass ProtonPlusUtilsSdlControllerHapticSinkDeviceClass;
enum  {
	PROTON_PLUS_UTILS_SDL_CONTROLLER_HAPTIC_SINK_0_PROPERTY,
	PROTON_PLUS_UTILS_SDL_CONTROLLER_HAPTIC_SINK_NUM_PROPERTIES
};
static GParamSpec* proton_plus_utils_sdl_controller_haptic_sink_properties[PROTON_PLUS_UTILS_SDL_CONTROLLER_HAPTIC_SINK_NUM_PROPERTIES];
typedef struct _ProtonPlusUtilsSdlControllerHapticSinkDevicePrivate ProtonPlusUtilsSdlControllerHapticSinkDevicePrivate;
enum  {
	PROTON_PLUS_UTILS_SDL_CONTROLLER_HAPTIC_SINK_DEVICE_0_PROPERTY,
	PROTON_PLUS_UTILS_SDL_CONTROLLER_HAPTIC_SINK_DEVICE_NUM_PROPERTIES
};
static GParamSpec* proton_plus_utils_sdl_controller_haptic_sink_device_properties[PROTON_PLUS_UTILS_SDL_CONTROLLER_HAPTIC_SINK_DEVICE_NUM_PROPERTIES];

struct _ProtonPlusUtilsControllerHapticPulsePrivate {
	guint16 _low_frequency_strength;
	guint16 _high_frequency_strength;
	guint32 _duration_ms;
};

struct _ProtonPlusUtilsControllerHapticPolicyPrivate {
	gboolean enabled;
	gboolean boundary_latched;
	ProtonPlusUtilsControllerNavigationDirection boundary_direction;
	gboolean has_last_pulse;
	ProtonPlusUtilsControllerHapticEvent last_event;
	gint64 last_pulse_time_usec;
};

struct _ProtonPlusUtilsControllerHapticFeedbackPrivate {
	ProtonPlusUtilsControllerHapticSink* sink;
	ProtonPlusUtilsControllerHapticPolicy* policy;
	gboolean has_active_device;
	gint64 active_device_id;
	gboolean input_active;
};

struct _ProtonPlusUtilsSdlControllerHapticSinkPrivate {
	GeeHashMap* devices;
};

struct _ProtonPlusUtilsSdlControllerHapticSinkDevice {
	GObject parent_instance;
	ProtonPlusUtilsSdlControllerHapticSinkDevicePrivate * priv;
	gint64 id;
	SDL_Gamepad* gamepad;
	gboolean capability_checked;
	gboolean rumble_supported;
	gboolean diagnostic_reported;
};

struct _ProtonPlusUtilsSdlControllerHapticSinkDeviceClass {
	GObjectClass parent_class;
};

static gint ProtonPlusUtilsControllerHapticPulse_private_offset;
static gpointer proton_plus_utils_controller_haptic_pulse_parent_class = NULL;
static gint ProtonPlusUtilsControllerHapticPolicy_private_offset;
static gpointer proton_plus_utils_controller_haptic_policy_parent_class = NULL;
static gint ProtonPlusUtilsControllerHapticFeedback_private_offset;
static gpointer proton_plus_utils_controller_haptic_feedback_parent_class = NULL;
static gint ProtonPlusUtilsSdlControllerHapticSink_private_offset;
static gpointer proton_plus_utils_sdl_controller_haptic_sink_parent_class = NULL;
static gpointer proton_plus_utils_sdl_controller_haptic_sink_device_parent_class = NULL;
static ProtonPlusUtilsControllerHapticSinkIface * proton_plus_utils_sdl_controller_haptic_sink_proton_plus_utils_controller_haptic_sink_parent_iface = NULL;

static void proton_plus_utils_controller_haptic_pulse_set_low_frequency_strength (ProtonPlusUtilsControllerHapticPulse* self,
                                                                           guint16 value);
static void proton_plus_utils_controller_haptic_pulse_set_high_frequency_strength (ProtonPlusUtilsControllerHapticPulse* self,
                                                                            guint16 value);
static void proton_plus_utils_controller_haptic_pulse_set_duration_ms (ProtonPlusUtilsControllerHapticPulse* self,
                                                                guint32 value);
static void proton_plus_utils_controller_haptic_pulse_finalize (GObject * obj);
static GType proton_plus_utils_controller_haptic_pulse_get_type_once (void);
static void _vala_proton_plus_utils_controller_haptic_pulse_get_property (GObject * object,
                                                                   guint property_id,
                                                                   GValue * value,
                                                                   GParamSpec * pspec);
static void _vala_proton_plus_utils_controller_haptic_pulse_set_property (GObject * object,
                                                                   guint property_id,
                                                                   const GValue * value,
                                                                   GParamSpec * pspec);
static GType proton_plus_utils_controller_haptic_sink_get_type_once (void);
static void proton_plus_utils_controller_haptic_policy_finalize (GObject * obj);
static GType proton_plus_utils_controller_haptic_policy_get_type_once (void);
static gboolean proton_plus_utils_controller_haptic_feedback_is_active_device (ProtonPlusUtilsControllerHapticFeedback* self,
                                                                        gint64 device_id);
static void proton_plus_utils_controller_haptic_feedback_emit (ProtonPlusUtilsControllerHapticFeedback* self,
                                                        ProtonPlusUtilsControllerHapticEvent event,
                                                        ProtonPlusUtilsControllerNavigationDirection direction,
                                                        gint64 now_usec);
static void proton_plus_utils_controller_haptic_feedback_finalize (GObject * obj);
static GType proton_plus_utils_controller_haptic_feedback_get_type_once (void);
static GType proton_plus_utils_sdl_controller_haptic_sink_device_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static gint64* _int64_dup (gint64* self);
static ProtonPlusUtilsSdlControllerHapticSinkDevice* proton_plus_utils_sdl_controller_haptic_sink_device_new (gint64 id,
                                                                                                       SDL_Gamepad* gamepad);
static ProtonPlusUtilsSdlControllerHapticSinkDevice* proton_plus_utils_sdl_controller_haptic_sink_device_construct (GType object_type,
                                                                                                             gint64 id,
                                                                                                             SDL_Gamepad* gamepad);
static gboolean proton_plus_utils_sdl_controller_haptic_sink_real_supports_device (ProtonPlusUtilsControllerHapticSink* base,
                                                                            gint64 device_id);
static void proton_plus_utils_sdl_controller_haptic_sink_report_failure_once (ProtonPlusUtilsSdlControllerHapticSink* self,
                                                                       ProtonPlusUtilsSdlControllerHapticSinkDevice* device,
                                                                       const gchar* message);
static gboolean proton_plus_utils_sdl_controller_haptic_sink_real_pulse (ProtonPlusUtilsControllerHapticSink* base,
                                                                  gint64 device_id,
                                                                  ProtonPlusUtilsControllerHapticPulse* pulse);
static void proton_plus_utils_sdl_controller_haptic_sink_real_stop (ProtonPlusUtilsControllerHapticSink* base,
                                                             gint64 device_id);
static void proton_plus_utils_sdl_controller_haptic_sink_device_finalize (GObject * obj);
static GType proton_plus_utils_sdl_controller_haptic_sink_device_get_type_once (void);
static void proton_plus_utils_sdl_controller_haptic_sink_finalize (GObject * obj);
static GType proton_plus_utils_sdl_controller_haptic_sink_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static GType
proton_plus_utils_controller_haptic_event_get_type_once (void)
{
	static const GEnumValue values[] = {{PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_EVENT_ACTIVATION, "PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_EVENT_ACTIVATION", "activation"}, {PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_EVENT_NAVIGATION, "PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_EVENT_NAVIGATION", "navigation"}, {PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_EVENT_BOUNDARY, "PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_EVENT_BOUNDARY", "boundary"}, {0, NULL, NULL}};
	GType proton_plus_utils_controller_haptic_event_type_id;
	proton_plus_utils_controller_haptic_event_type_id = g_enum_register_static ("ProtonPlusUtilsControllerHapticEvent", values);
	return proton_plus_utils_controller_haptic_event_type_id;
}

GType
proton_plus_utils_controller_haptic_event_get_type (void)
{
	static volatile gsize proton_plus_utils_controller_haptic_event_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_controller_haptic_event_type_id__once)) {
		GType proton_plus_utils_controller_haptic_event_type_id;
		proton_plus_utils_controller_haptic_event_type_id = proton_plus_utils_controller_haptic_event_get_type_once ();
		g_once_init_leave (&proton_plus_utils_controller_haptic_event_type_id__once, proton_plus_utils_controller_haptic_event_type_id);
	}
	return proton_plus_utils_controller_haptic_event_type_id__once;
}

static inline gpointer
proton_plus_utils_controller_haptic_pulse_get_instance_private (ProtonPlusUtilsControllerHapticPulse* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusUtilsControllerHapticPulse_private_offset);
}

ProtonPlusUtilsControllerHapticPulse*
proton_plus_utils_controller_haptic_pulse_construct (GType object_type,
                                                     guint16 low_frequency_strength,
                                                     guint16 high_frequency_strength,
                                                     guint32 duration_ms)
{
	ProtonPlusUtilsControllerHapticPulse * self = NULL;
	self = (ProtonPlusUtilsControllerHapticPulse*) g_object_new (object_type, NULL);
	proton_plus_utils_controller_haptic_pulse_set_low_frequency_strength (self, low_frequency_strength);
	proton_plus_utils_controller_haptic_pulse_set_high_frequency_strength (self, high_frequency_strength);
	proton_plus_utils_controller_haptic_pulse_set_duration_ms (self, duration_ms);
	return self;
}

ProtonPlusUtilsControllerHapticPulse*
proton_plus_utils_controller_haptic_pulse_new (guint16 low_frequency_strength,
                                               guint16 high_frequency_strength,
                                               guint32 duration_ms)
{
	return proton_plus_utils_controller_haptic_pulse_construct (PROTON_PLUS_UTILS_TYPE_CONTROLLER_HAPTIC_PULSE, low_frequency_strength, high_frequency_strength, duration_ms);
}

guint16
proton_plus_utils_controller_haptic_pulse_get_low_frequency_strength (ProtonPlusUtilsControllerHapticPulse* self)
{
	guint16 result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->_low_frequency_strength;
	return result;
}

static void
proton_plus_utils_controller_haptic_pulse_set_low_frequency_strength (ProtonPlusUtilsControllerHapticPulse* self,
                                                                      guint16 value)
{
	guint16 old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_controller_haptic_pulse_get_low_frequency_strength (self);
	if (old_value != value) {
		self->priv->_low_frequency_strength = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_controller_haptic_pulse_properties[PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_PULSE_LOW_FREQUENCY_STRENGTH_PROPERTY]);
	}
}

guint16
proton_plus_utils_controller_haptic_pulse_get_high_frequency_strength (ProtonPlusUtilsControllerHapticPulse* self)
{
	guint16 result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->_high_frequency_strength;
	return result;
}

static void
proton_plus_utils_controller_haptic_pulse_set_high_frequency_strength (ProtonPlusUtilsControllerHapticPulse* self,
                                                                       guint16 value)
{
	guint16 old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_controller_haptic_pulse_get_high_frequency_strength (self);
	if (old_value != value) {
		self->priv->_high_frequency_strength = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_controller_haptic_pulse_properties[PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_PULSE_HIGH_FREQUENCY_STRENGTH_PROPERTY]);
	}
}

guint32
proton_plus_utils_controller_haptic_pulse_get_duration_ms (ProtonPlusUtilsControllerHapticPulse* self)
{
	guint32 result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->_duration_ms;
	return result;
}

static void
proton_plus_utils_controller_haptic_pulse_set_duration_ms (ProtonPlusUtilsControllerHapticPulse* self,
                                                           guint32 value)
{
	guint32 old_value;
	g_return_if_fail (self != NULL);
	old_value = proton_plus_utils_controller_haptic_pulse_get_duration_ms (self);
	if (old_value != value) {
		self->priv->_duration_ms = value;
		g_object_notify_by_pspec ((GObject *) self, proton_plus_utils_controller_haptic_pulse_properties[PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_PULSE_DURATION_MS_PROPERTY]);
	}
}

static void
proton_plus_utils_controller_haptic_pulse_class_init (ProtonPlusUtilsControllerHapticPulseClass * klass,
                                                      gpointer klass_data)
{
	proton_plus_utils_controller_haptic_pulse_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusUtilsControllerHapticPulse_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_proton_plus_utils_controller_haptic_pulse_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_proton_plus_utils_controller_haptic_pulse_set_property;
	G_OBJECT_CLASS (klass)->finalize = proton_plus_utils_controller_haptic_pulse_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_PULSE_LOW_FREQUENCY_STRENGTH_PROPERTY, proton_plus_utils_controller_haptic_pulse_properties[PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_PULSE_LOW_FREQUENCY_STRENGTH_PROPERTY] = g_param_spec_uint ("low-frequency-strength", "low-frequency-strength", "low-frequency-strength", 0, G_MAXUINT, 0U, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_PULSE_HIGH_FREQUENCY_STRENGTH_PROPERTY, proton_plus_utils_controller_haptic_pulse_properties[PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_PULSE_HIGH_FREQUENCY_STRENGTH_PROPERTY] = g_param_spec_uint ("high-frequency-strength", "high-frequency-strength", "high-frequency-strength", 0, G_MAXUINT, 0U, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_PULSE_DURATION_MS_PROPERTY, proton_plus_utils_controller_haptic_pulse_properties[PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_PULSE_DURATION_MS_PROPERTY] = g_param_spec_uint ("duration-ms", "duration-ms", "duration-ms", 0, G_MAXUINT, 0U, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
proton_plus_utils_controller_haptic_pulse_instance_init (ProtonPlusUtilsControllerHapticPulse * self,
                                                         gpointer klass)
{
	self->priv = proton_plus_utils_controller_haptic_pulse_get_instance_private (self);
}

static void
proton_plus_utils_controller_haptic_pulse_finalize (GObject * obj)
{
	ProtonPlusUtilsControllerHapticPulse * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_UTILS_TYPE_CONTROLLER_HAPTIC_PULSE, ProtonPlusUtilsControllerHapticPulse);
	G_OBJECT_CLASS (proton_plus_utils_controller_haptic_pulse_parent_class)->finalize (obj);
}

static GType
proton_plus_utils_controller_haptic_pulse_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsControllerHapticPulseClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_controller_haptic_pulse_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusUtilsControllerHapticPulse), 0, (GInstanceInitFunc) proton_plus_utils_controller_haptic_pulse_instance_init, NULL };
	GType proton_plus_utils_controller_haptic_pulse_type_id;
	proton_plus_utils_controller_haptic_pulse_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusUtilsControllerHapticPulse", &g_define_type_info, 0);
	ProtonPlusUtilsControllerHapticPulse_private_offset = g_type_add_instance_private (proton_plus_utils_controller_haptic_pulse_type_id, sizeof (ProtonPlusUtilsControllerHapticPulsePrivate));
	return proton_plus_utils_controller_haptic_pulse_type_id;
}

GType
proton_plus_utils_controller_haptic_pulse_get_type (void)
{
	static volatile gsize proton_plus_utils_controller_haptic_pulse_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_controller_haptic_pulse_type_id__once)) {
		GType proton_plus_utils_controller_haptic_pulse_type_id;
		proton_plus_utils_controller_haptic_pulse_type_id = proton_plus_utils_controller_haptic_pulse_get_type_once ();
		g_once_init_leave (&proton_plus_utils_controller_haptic_pulse_type_id__once, proton_plus_utils_controller_haptic_pulse_type_id);
	}
	return proton_plus_utils_controller_haptic_pulse_type_id__once;
}

static void
_vala_proton_plus_utils_controller_haptic_pulse_get_property (GObject * object,
                                                              guint property_id,
                                                              GValue * value,
                                                              GParamSpec * pspec)
{
	ProtonPlusUtilsControllerHapticPulse * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_UTILS_TYPE_CONTROLLER_HAPTIC_PULSE, ProtonPlusUtilsControllerHapticPulse);
	switch (property_id) {
		case PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_PULSE_LOW_FREQUENCY_STRENGTH_PROPERTY:
		g_value_set_uint (value, proton_plus_utils_controller_haptic_pulse_get_low_frequency_strength (self));
		break;
		case PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_PULSE_HIGH_FREQUENCY_STRENGTH_PROPERTY:
		g_value_set_uint (value, proton_plus_utils_controller_haptic_pulse_get_high_frequency_strength (self));
		break;
		case PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_PULSE_DURATION_MS_PROPERTY:
		g_value_set_uint (value, proton_plus_utils_controller_haptic_pulse_get_duration_ms (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_proton_plus_utils_controller_haptic_pulse_set_property (GObject * object,
                                                              guint property_id,
                                                              const GValue * value,
                                                              GParamSpec * pspec)
{
	ProtonPlusUtilsControllerHapticPulse * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, PROTON_PLUS_UTILS_TYPE_CONTROLLER_HAPTIC_PULSE, ProtonPlusUtilsControllerHapticPulse);
	switch (property_id) {
		case PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_PULSE_LOW_FREQUENCY_STRENGTH_PROPERTY:
		proton_plus_utils_controller_haptic_pulse_set_low_frequency_strength (self, g_value_get_uint (value));
		break;
		case PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_PULSE_HIGH_FREQUENCY_STRENGTH_PROPERTY:
		proton_plus_utils_controller_haptic_pulse_set_high_frequency_strength (self, g_value_get_uint (value));
		break;
		case PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_PULSE_DURATION_MS_PROPERTY:
		proton_plus_utils_controller_haptic_pulse_set_duration_ms (self, g_value_get_uint (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

gboolean
proton_plus_utils_controller_haptic_sink_supports_device (ProtonPlusUtilsControllerHapticSink* self,
                                                          gint64 device_id)
{
	ProtonPlusUtilsControllerHapticSinkIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_SINK_GET_INTERFACE (self);
	if (_iface_->supports_device) {
		return _iface_->supports_device (self, device_id);
	}
	return FALSE;
}

gboolean
proton_plus_utils_controller_haptic_sink_pulse (ProtonPlusUtilsControllerHapticSink* self,
                                                gint64 device_id,
                                                ProtonPlusUtilsControllerHapticPulse* pulse)
{
	ProtonPlusUtilsControllerHapticSinkIface* _iface_;
	g_return_val_if_fail (self != NULL, FALSE);
	_iface_ = PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_SINK_GET_INTERFACE (self);
	if (_iface_->pulse) {
		return _iface_->pulse (self, device_id, pulse);
	}
	return FALSE;
}

void
proton_plus_utils_controller_haptic_sink_stop (ProtonPlusUtilsControllerHapticSink* self,
                                               gint64 device_id)
{
	ProtonPlusUtilsControllerHapticSinkIface* _iface_;
	g_return_if_fail (self != NULL);
	_iface_ = PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_SINK_GET_INTERFACE (self);
	if (_iface_->stop) {
		_iface_->stop (self, device_id);
	}
}

static void
proton_plus_utils_controller_haptic_sink_default_init (ProtonPlusUtilsControllerHapticSinkIface * iface,
                                                       gpointer iface_data)
{
}

static GType
proton_plus_utils_controller_haptic_sink_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsControllerHapticSinkIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_controller_haptic_sink_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
	GType proton_plus_utils_controller_haptic_sink_type_id;
	proton_plus_utils_controller_haptic_sink_type_id = g_type_register_static (G_TYPE_INTERFACE, "ProtonPlusUtilsControllerHapticSink", &g_define_type_info, 0);
	g_type_interface_add_prerequisite (proton_plus_utils_controller_haptic_sink_type_id, G_TYPE_OBJECT);
	return proton_plus_utils_controller_haptic_sink_type_id;
}

GType
proton_plus_utils_controller_haptic_sink_get_type (void)
{
	static volatile gsize proton_plus_utils_controller_haptic_sink_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_controller_haptic_sink_type_id__once)) {
		GType proton_plus_utils_controller_haptic_sink_type_id;
		proton_plus_utils_controller_haptic_sink_type_id = proton_plus_utils_controller_haptic_sink_get_type_once ();
		g_once_init_leave (&proton_plus_utils_controller_haptic_sink_type_id__once, proton_plus_utils_controller_haptic_sink_type_id);
	}
	return proton_plus_utils_controller_haptic_sink_type_id__once;
}

static inline gpointer
proton_plus_utils_controller_haptic_policy_get_instance_private (ProtonPlusUtilsControllerHapticPolicy* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusUtilsControllerHapticPolicy_private_offset);
}

void
proton_plus_utils_controller_haptic_policy_set_enabled (ProtonPlusUtilsControllerHapticPolicy* self,
                                                        gboolean enabled)
{
	g_return_if_fail (self != NULL);
	if (self->priv->enabled == enabled) {
		return;
	}
	self->priv->enabled = enabled;
	proton_plus_utils_controller_haptic_policy_reset_session (self);
}

ProtonPlusUtilsControllerHapticPulse*
proton_plus_utils_controller_haptic_policy_pulse_for (ProtonPlusUtilsControllerHapticPolicy* self,
                                                      ProtonPlusUtilsControllerHapticEvent event,
                                                      ProtonPlusUtilsControllerNavigationDirection direction,
                                                      gint64 now_usec)
{
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	ProtonPlusUtilsControllerHapticPulse* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (!self->priv->enabled) {
		result = NULL;
		return result;
	}
	if (event == PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_EVENT_BOUNDARY) {
		gboolean _tmp0_ = FALSE;
		if (direction == PROTON_PLUS_UTILS_CONTROLLER_NAVIGATION_DIRECTION_NONE) {
			result = NULL;
			return result;
		}
		if (self->priv->boundary_latched) {
			_tmp0_ = self->priv->boundary_direction == direction;
		} else {
			_tmp0_ = FALSE;
		}
		if (_tmp0_) {
			result = NULL;
			return result;
		}
		self->priv->boundary_latched = TRUE;
		self->priv->boundary_direction = direction;
	}
	if (self->priv->has_last_pulse) {
		_tmp3_ = self->priv->last_event == event;
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		_tmp2_ = now_usec >= self->priv->last_pulse_time_usec;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		_tmp1_ = (now_usec - self->priv->last_pulse_time_usec) < PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_POLICY_DUPLICATE_COOLDOWN_USEC;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		result = NULL;
		return result;
	}
	self->priv->has_last_pulse = TRUE;
	self->priv->last_event = event;
	self->priv->last_pulse_time_usec = now_usec;
	switch (event) {
		case PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_EVENT_ACTIVATION:
		{
			ProtonPlusUtilsControllerHapticPulse* _tmp4_;
			_tmp4_ = proton_plus_utils_controller_haptic_pulse_new ((guint16) 7000, (guint16) 12000, (guint32) 55);
			result = _tmp4_;
			return result;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_EVENT_NAVIGATION:
		{
			ProtonPlusUtilsControllerHapticPulse* _tmp5_;
			_tmp5_ = proton_plus_utils_controller_haptic_pulse_new ((guint16) 4500, (guint16) 7500, (guint32) 45);
			result = _tmp5_;
			return result;
		}
		case PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_EVENT_BOUNDARY:
		{
			ProtonPlusUtilsControllerHapticPulse* _tmp6_;
			_tmp6_ = proton_plus_utils_controller_haptic_pulse_new ((guint16) 10500, (guint16) 2500, (guint32) 35);
			result = _tmp6_;
			return result;
		}
		default:
		{
			result = NULL;
			return result;
		}
	}
}

void
proton_plus_utils_controller_haptic_policy_direction_released (ProtonPlusUtilsControllerHapticPolicy* self,
                                                               ProtonPlusUtilsControllerNavigationDirection direction)
{
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	if (self->priv->boundary_latched) {
		_tmp0_ = self->priv->boundary_direction == direction;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		proton_plus_utils_controller_haptic_policy_reset_boundary (self);
	}
}

void
proton_plus_utils_controller_haptic_policy_reset_boundary (ProtonPlusUtilsControllerHapticPolicy* self)
{
	g_return_if_fail (self != NULL);
	self->priv->boundary_latched = FALSE;
	self->priv->boundary_direction = PROTON_PLUS_UTILS_CONTROLLER_NAVIGATION_DIRECTION_NONE;
}

void
proton_plus_utils_controller_haptic_policy_reset_session (ProtonPlusUtilsControllerHapticPolicy* self)
{
	g_return_if_fail (self != NULL);
	proton_plus_utils_controller_haptic_policy_reset_boundary (self);
	self->priv->has_last_pulse = FALSE;
	self->priv->last_event = PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_EVENT_ACTIVATION;
	self->priv->last_pulse_time_usec = (gint64) 0;
}

ProtonPlusUtilsControllerHapticPolicy*
proton_plus_utils_controller_haptic_policy_construct (GType object_type)
{
	ProtonPlusUtilsControllerHapticPolicy * self = NULL;
	self = (ProtonPlusUtilsControllerHapticPolicy*) g_object_new (object_type, NULL);
	return self;
}

ProtonPlusUtilsControllerHapticPolicy*
proton_plus_utils_controller_haptic_policy_new (void)
{
	return proton_plus_utils_controller_haptic_policy_construct (PROTON_PLUS_UTILS_TYPE_CONTROLLER_HAPTIC_POLICY);
}

static void
proton_plus_utils_controller_haptic_policy_class_init (ProtonPlusUtilsControllerHapticPolicyClass * klass,
                                                       gpointer klass_data)
{
	proton_plus_utils_controller_haptic_policy_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusUtilsControllerHapticPolicy_private_offset);
	G_OBJECT_CLASS (klass)->finalize = proton_plus_utils_controller_haptic_policy_finalize;
}

static void
proton_plus_utils_controller_haptic_policy_instance_init (ProtonPlusUtilsControllerHapticPolicy * self,
                                                          gpointer klass)
{
	self->priv = proton_plus_utils_controller_haptic_policy_get_instance_private (self);
	self->priv->enabled = FALSE;
	self->priv->boundary_latched = FALSE;
	self->priv->boundary_direction = PROTON_PLUS_UTILS_CONTROLLER_NAVIGATION_DIRECTION_NONE;
	self->priv->has_last_pulse = FALSE;
	self->priv->last_event = PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_EVENT_ACTIVATION;
	self->priv->last_pulse_time_usec = (gint64) 0;
}

static void
proton_plus_utils_controller_haptic_policy_finalize (GObject * obj)
{
	ProtonPlusUtilsControllerHapticPolicy * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_UTILS_TYPE_CONTROLLER_HAPTIC_POLICY, ProtonPlusUtilsControllerHapticPolicy);
	G_OBJECT_CLASS (proton_plus_utils_controller_haptic_policy_parent_class)->finalize (obj);
}

static GType
proton_plus_utils_controller_haptic_policy_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsControllerHapticPolicyClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_controller_haptic_policy_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusUtilsControllerHapticPolicy), 0, (GInstanceInitFunc) proton_plus_utils_controller_haptic_policy_instance_init, NULL };
	GType proton_plus_utils_controller_haptic_policy_type_id;
	proton_plus_utils_controller_haptic_policy_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusUtilsControllerHapticPolicy", &g_define_type_info, 0);
	ProtonPlusUtilsControllerHapticPolicy_private_offset = g_type_add_instance_private (proton_plus_utils_controller_haptic_policy_type_id, sizeof (ProtonPlusUtilsControllerHapticPolicyPrivate));
	return proton_plus_utils_controller_haptic_policy_type_id;
}

GType
proton_plus_utils_controller_haptic_policy_get_type (void)
{
	static volatile gsize proton_plus_utils_controller_haptic_policy_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_controller_haptic_policy_type_id__once)) {
		GType proton_plus_utils_controller_haptic_policy_type_id;
		proton_plus_utils_controller_haptic_policy_type_id = proton_plus_utils_controller_haptic_policy_get_type_once ();
		g_once_init_leave (&proton_plus_utils_controller_haptic_policy_type_id__once, proton_plus_utils_controller_haptic_policy_type_id);
	}
	return proton_plus_utils_controller_haptic_policy_type_id__once;
}

static inline gpointer
proton_plus_utils_controller_haptic_feedback_get_instance_private (ProtonPlusUtilsControllerHapticFeedback* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusUtilsControllerHapticFeedback_private_offset);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

ProtonPlusUtilsControllerHapticFeedback*
proton_plus_utils_controller_haptic_feedback_construct (GType object_type,
                                                        ProtonPlusUtilsControllerHapticSink* sink,
                                                        ProtonPlusUtilsControllerHapticPolicy* policy)
{
	ProtonPlusUtilsControllerHapticFeedback * self = NULL;
	ProtonPlusUtilsControllerHapticSink* _tmp0_;
	ProtonPlusUtilsControllerHapticPolicy* _tmp1_ = NULL;
	ProtonPlusUtilsControllerHapticPolicy* _tmp2_;
	ProtonPlusUtilsControllerHapticPolicy* _tmp4_;
	g_return_val_if_fail (sink != NULL, NULL);
	self = (ProtonPlusUtilsControllerHapticFeedback*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (sink);
	_g_object_unref0 (self->priv->sink);
	self->priv->sink = _tmp0_;
	_tmp2_ = _g_object_ref0 (policy);
	_tmp1_ = _tmp2_;
	if (_tmp1_ == NULL) {
		ProtonPlusUtilsControllerHapticPolicy* _tmp3_;
		_tmp3_ = proton_plus_utils_controller_haptic_policy_new ();
		_g_object_unref0 (_tmp1_);
		_tmp1_ = _tmp3_;
	}
	_tmp4_ = _tmp1_;
	_tmp1_ = NULL;
	_g_object_unref0 (self->priv->policy);
	self->priv->policy = _tmp4_;
	_g_object_unref0 (_tmp1_);
	return self;
}

ProtonPlusUtilsControllerHapticFeedback*
proton_plus_utils_controller_haptic_feedback_new (ProtonPlusUtilsControllerHapticSink* sink,
                                                  ProtonPlusUtilsControllerHapticPolicy* policy)
{
	return proton_plus_utils_controller_haptic_feedback_construct (PROTON_PLUS_UTILS_TYPE_CONTROLLER_HAPTIC_FEEDBACK, sink, policy);
}

void
proton_plus_utils_controller_haptic_feedback_set_enabled (ProtonPlusUtilsControllerHapticFeedback* self,
                                                          gboolean enabled)
{
	gboolean _tmp0_ = FALSE;
	ProtonPlusUtilsControllerHapticPolicy* _tmp2_;
	g_return_if_fail (self != NULL);
	if (!enabled) {
		_tmp0_ = self->priv->has_active_device;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		ProtonPlusUtilsControllerHapticSink* _tmp1_;
		_tmp1_ = self->priv->sink;
		proton_plus_utils_controller_haptic_sink_stop (_tmp1_, self->priv->active_device_id);
	}
	_tmp2_ = self->priv->policy;
	proton_plus_utils_controller_haptic_policy_set_enabled (_tmp2_, enabled);
}

void
proton_plus_utils_controller_haptic_feedback_claim_device (ProtonPlusUtilsControllerHapticFeedback* self,
                                                           gint64 device_id)
{
	gboolean _tmp0_ = FALSE;
	ProtonPlusUtilsControllerHapticPolicy* _tmp2_;
	g_return_if_fail (self != NULL);
	if (self->priv->has_active_device) {
		_tmp0_ = self->priv->active_device_id == device_id;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		return;
	}
	if (self->priv->has_active_device) {
		ProtonPlusUtilsControllerHapticSink* _tmp1_;
		_tmp1_ = self->priv->sink;
		proton_plus_utils_controller_haptic_sink_stop (_tmp1_, self->priv->active_device_id);
	}
	self->priv->has_active_device = TRUE;
	self->priv->active_device_id = device_id;
	_tmp2_ = self->priv->policy;
	proton_plus_utils_controller_haptic_policy_reset_session (_tmp2_);
}

void
proton_plus_utils_controller_haptic_feedback_disconnect_device (ProtonPlusUtilsControllerHapticFeedback* self,
                                                                gint64 device_id)
{
	gboolean _tmp0_ = FALSE;
	ProtonPlusUtilsControllerHapticSink* _tmp1_;
	ProtonPlusUtilsControllerHapticPolicy* _tmp2_;
	g_return_if_fail (self != NULL);
	if (!self->priv->has_active_device) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = self->priv->active_device_id != device_id;
	}
	if (_tmp0_) {
		return;
	}
	_tmp1_ = self->priv->sink;
	proton_plus_utils_controller_haptic_sink_stop (_tmp1_, self->priv->active_device_id);
	self->priv->has_active_device = FALSE;
	self->priv->active_device_id = (gint64) 0;
	_tmp2_ = self->priv->policy;
	proton_plus_utils_controller_haptic_policy_reset_session (_tmp2_);
}

void
proton_plus_utils_controller_haptic_feedback_stop (ProtonPlusUtilsControllerHapticFeedback* self)
{
	ProtonPlusUtilsControllerHapticPolicy* _tmp1_;
	g_return_if_fail (self != NULL);
	if (self->priv->has_active_device) {
		ProtonPlusUtilsControllerHapticSink* _tmp0_;
		_tmp0_ = self->priv->sink;
		proton_plus_utils_controller_haptic_sink_stop (_tmp0_, self->priv->active_device_id);
	}
	self->priv->has_active_device = FALSE;
	self->priv->active_device_id = (gint64) 0;
	_tmp1_ = self->priv->policy;
	proton_plus_utils_controller_haptic_policy_reset_session (_tmp1_);
}

void
proton_plus_utils_controller_haptic_feedback_set_input_active (ProtonPlusUtilsControllerHapticFeedback* self,
                                                               gboolean active)
{
	gboolean _tmp0_ = FALSE;
	ProtonPlusUtilsControllerHapticPolicy* _tmp2_;
	g_return_if_fail (self != NULL);
	if (self->priv->input_active == active) {
		return;
	}
	self->priv->input_active = active;
	if (!active) {
		_tmp0_ = self->priv->has_active_device;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		ProtonPlusUtilsControllerHapticSink* _tmp1_;
		_tmp1_ = self->priv->sink;
		proton_plus_utils_controller_haptic_sink_stop (_tmp1_, self->priv->active_device_id);
	}
	_tmp2_ = self->priv->policy;
	proton_plus_utils_controller_haptic_policy_reset_session (_tmp2_);
}

void
proton_plus_utils_controller_haptic_feedback_context_changed (ProtonPlusUtilsControllerHapticFeedback* self)
{
	ProtonPlusUtilsControllerHapticPolicy* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->policy;
	proton_plus_utils_controller_haptic_policy_reset_boundary (_tmp0_);
}

void
proton_plus_utils_controller_haptic_feedback_direction_released (ProtonPlusUtilsControllerHapticFeedback* self,
                                                                 gint64 device_id,
                                                                 ProtonPlusUtilsControllerNavigationDirection direction)
{
	g_return_if_fail (self != NULL);
	if (proton_plus_utils_controller_haptic_feedback_is_active_device (self, device_id)) {
		ProtonPlusUtilsControllerHapticPolicy* _tmp0_;
		_tmp0_ = self->priv->policy;
		proton_plus_utils_controller_haptic_policy_direction_released (_tmp0_, direction);
	}
}

void
proton_plus_utils_controller_haptic_feedback_direction_outcome (ProtonPlusUtilsControllerHapticFeedback* self,
                                                                gint64 device_id,
                                                                ProtonPlusUtilsControllerNavigationDirection direction,
                                                                gboolean moved,
                                                                gint64 now_usec)
{
	g_return_if_fail (self != NULL);
	if (!proton_plus_utils_controller_haptic_feedback_is_active_device (self, device_id)) {
		return;
	}
	if (moved) {
		ProtonPlusUtilsControllerHapticPolicy* _tmp0_;
		_tmp0_ = self->priv->policy;
		proton_plus_utils_controller_haptic_policy_reset_boundary (_tmp0_);
		return;
	}
	proton_plus_utils_controller_haptic_feedback_emit (self, PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_EVENT_BOUNDARY, direction, now_usec);
}

void
proton_plus_utils_controller_haptic_feedback_activation_outcome (ProtonPlusUtilsControllerHapticFeedback* self,
                                                                 gint64 device_id,
                                                                 ProtonPlusUtilsControllerActivationDecision decision,
                                                                 gboolean succeeded,
                                                                 gint64 now_usec)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	ProtonPlusUtilsControllerHapticPolicy* _tmp2_;
	g_return_if_fail (self != NULL);
	if (!proton_plus_utils_controller_haptic_feedback_is_active_device (self, device_id)) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = !succeeded;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = decision != PROTON_PLUS_UTILS_CONTROLLER_ACTIVATION_DECISION_ACTIVATE;
	}
	if (_tmp0_) {
		return;
	}
	_tmp2_ = self->priv->policy;
	proton_plus_utils_controller_haptic_policy_reset_boundary (_tmp2_);
	proton_plus_utils_controller_haptic_feedback_emit (self, PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_EVENT_ACTIVATION, PROTON_PLUS_UTILS_CONTROLLER_NAVIGATION_DIRECTION_NONE, now_usec);
}

void
proton_plus_utils_controller_haptic_feedback_navigation_outcome (ProtonPlusUtilsControllerHapticFeedback* self,
                                                                 gint64 device_id,
                                                                 gboolean succeeded,
                                                                 gint64 now_usec)
{
	gboolean _tmp0_ = FALSE;
	ProtonPlusUtilsControllerHapticPolicy* _tmp1_;
	g_return_if_fail (self != NULL);
	if (!proton_plus_utils_controller_haptic_feedback_is_active_device (self, device_id)) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = !succeeded;
	}
	if (_tmp0_) {
		return;
	}
	_tmp1_ = self->priv->policy;
	proton_plus_utils_controller_haptic_policy_reset_boundary (_tmp1_);
	proton_plus_utils_controller_haptic_feedback_emit (self, PROTON_PLUS_UTILS_CONTROLLER_HAPTIC_EVENT_NAVIGATION, PROTON_PLUS_UTILS_CONTROLLER_NAVIGATION_DIRECTION_NONE, now_usec);
}

static gboolean
proton_plus_utils_controller_haptic_feedback_is_active_device (ProtonPlusUtilsControllerHapticFeedback* self,
                                                               gint64 device_id)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (self->priv->input_active) {
		_tmp1_ = self->priv->has_active_device;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		_tmp0_ = self->priv->active_device_id == device_id;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static void
proton_plus_utils_controller_haptic_feedback_emit (ProtonPlusUtilsControllerHapticFeedback* self,
                                                   ProtonPlusUtilsControllerHapticEvent event,
                                                   ProtonPlusUtilsControllerNavigationDirection direction,
                                                   gint64 now_usec)
{
	ProtonPlusUtilsControllerHapticPulse* pulse = NULL;
	ProtonPlusUtilsControllerHapticPolicy* _tmp0_;
	ProtonPlusUtilsControllerHapticPulse* _tmp1_;
	gboolean _tmp2_ = FALSE;
	ProtonPlusUtilsControllerHapticPulse* _tmp3_;
	ProtonPlusUtilsControllerHapticSink* _tmp5_;
	ProtonPlusUtilsControllerHapticPulse* _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->policy;
	_tmp1_ = proton_plus_utils_controller_haptic_policy_pulse_for (_tmp0_, event, direction, now_usec);
	pulse = _tmp1_;
	_tmp3_ = pulse;
	if (_tmp3_ == NULL) {
		_tmp2_ = TRUE;
	} else {
		ProtonPlusUtilsControllerHapticSink* _tmp4_;
		_tmp4_ = self->priv->sink;
		_tmp2_ = !proton_plus_utils_controller_haptic_sink_supports_device (_tmp4_, self->priv->active_device_id);
	}
	if (_tmp2_) {
		_g_object_unref0 (pulse);
		return;
	}
	_tmp5_ = self->priv->sink;
	_tmp6_ = pulse;
	proton_plus_utils_controller_haptic_sink_pulse (_tmp5_, self->priv->active_device_id, G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, PROTON_PLUS_UTILS_TYPE_CONTROLLER_HAPTIC_PULSE, ProtonPlusUtilsControllerHapticPulse));
	_g_object_unref0 (pulse);
}

static void
proton_plus_utils_controller_haptic_feedback_class_init (ProtonPlusUtilsControllerHapticFeedbackClass * klass,
                                                         gpointer klass_data)
{
	proton_plus_utils_controller_haptic_feedback_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusUtilsControllerHapticFeedback_private_offset);
	G_OBJECT_CLASS (klass)->finalize = proton_plus_utils_controller_haptic_feedback_finalize;
}

static void
proton_plus_utils_controller_haptic_feedback_instance_init (ProtonPlusUtilsControllerHapticFeedback * self,
                                                            gpointer klass)
{
	self->priv = proton_plus_utils_controller_haptic_feedback_get_instance_private (self);
	self->priv->has_active_device = FALSE;
	self->priv->active_device_id = (gint64) 0;
	self->priv->input_active = TRUE;
}

static void
proton_plus_utils_controller_haptic_feedback_finalize (GObject * obj)
{
	ProtonPlusUtilsControllerHapticFeedback * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_UTILS_TYPE_CONTROLLER_HAPTIC_FEEDBACK, ProtonPlusUtilsControllerHapticFeedback);
	_g_object_unref0 (self->priv->sink);
	_g_object_unref0 (self->priv->policy);
	G_OBJECT_CLASS (proton_plus_utils_controller_haptic_feedback_parent_class)->finalize (obj);
}

static GType
proton_plus_utils_controller_haptic_feedback_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsControllerHapticFeedbackClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_controller_haptic_feedback_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusUtilsControllerHapticFeedback), 0, (GInstanceInitFunc) proton_plus_utils_controller_haptic_feedback_instance_init, NULL };
	GType proton_plus_utils_controller_haptic_feedback_type_id;
	proton_plus_utils_controller_haptic_feedback_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusUtilsControllerHapticFeedback", &g_define_type_info, 0);
	ProtonPlusUtilsControllerHapticFeedback_private_offset = g_type_add_instance_private (proton_plus_utils_controller_haptic_feedback_type_id, sizeof (ProtonPlusUtilsControllerHapticFeedbackPrivate));
	return proton_plus_utils_controller_haptic_feedback_type_id;
}

GType
proton_plus_utils_controller_haptic_feedback_get_type (void)
{
	static volatile gsize proton_plus_utils_controller_haptic_feedback_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_controller_haptic_feedback_type_id__once)) {
		GType proton_plus_utils_controller_haptic_feedback_type_id;
		proton_plus_utils_controller_haptic_feedback_type_id = proton_plus_utils_controller_haptic_feedback_get_type_once ();
		g_once_init_leave (&proton_plus_utils_controller_haptic_feedback_type_id__once, proton_plus_utils_controller_haptic_feedback_type_id);
	}
	return proton_plus_utils_controller_haptic_feedback_type_id__once;
}

static inline gpointer
proton_plus_utils_sdl_controller_haptic_sink_get_instance_private (ProtonPlusUtilsSdlControllerHapticSink* self)
{
	return G_STRUCT_MEMBER_P (self, ProtonPlusUtilsSdlControllerHapticSink_private_offset);
}

static gint64*
_int64_dup (gint64* self)
{
	gint64* dup;
	dup = g_new0 (gint64, 1);
	memcpy (dup, self, sizeof (gint64));
	return dup;
}

void
proton_plus_utils_sdl_controller_haptic_sink_register_device (ProtonPlusUtilsSdlControllerHapticSink* self,
                                                              gint64 device_id,
                                                              SDL_Gamepad* gamepad)
{
	GeeHashMap* _tmp0_;
	ProtonPlusUtilsSdlControllerHapticSinkDevice* _tmp1_;
	ProtonPlusUtilsSdlControllerHapticSinkDevice* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (gamepad != NULL);
	_tmp0_ = self->priv->devices;
	_tmp1_ = proton_plus_utils_sdl_controller_haptic_sink_device_new (device_id, gamepad);
	_tmp2_ = _tmp1_;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp0_, &device_id, _tmp2_);
	_g_object_unref0 (_tmp2_);
}

void
proton_plus_utils_sdl_controller_haptic_sink_unregister_device (ProtonPlusUtilsSdlControllerHapticSink* self,
                                                                gint64 device_id)
{
	GeeHashMap* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->devices;
	gee_abstract_map_unset ((GeeAbstractMap*) _tmp0_, &device_id, NULL);
}

static gboolean
proton_plus_utils_sdl_controller_haptic_sink_real_supports_device (ProtonPlusUtilsControllerHapticSink* base,
                                                                   gint64 device_id)
{
	ProtonPlusUtilsSdlControllerHapticSink * self;
	ProtonPlusUtilsSdlControllerHapticSinkDevice* device = NULL;
	GeeHashMap* _tmp0_;
	gpointer _tmp1_;
	ProtonPlusUtilsSdlControllerHapticSinkDevice* _tmp2_;
	ProtonPlusUtilsSdlControllerHapticSinkDevice* _tmp3_;
	ProtonPlusUtilsSdlControllerHapticSinkDevice* _tmp5_;
	SDL_PropertiesID properties = 0U;
	ProtonPlusUtilsSdlControllerHapticSinkDevice* _tmp6_;
	SDL_Gamepad* _tmp7_;
	ProtonPlusUtilsSdlControllerHapticSinkDevice* _tmp9_;
	ProtonPlusUtilsSdlControllerHapticSinkDevice* _tmp10_;
	gboolean result;
	self = (ProtonPlusUtilsSdlControllerHapticSink*) base;
	_tmp0_ = self->priv->devices;
	_tmp1_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp0_, &device_id);
	device = (ProtonPlusUtilsSdlControllerHapticSinkDevice*) _tmp1_;
	_tmp2_ = device;
	if (_tmp2_ == NULL) {
		result = FALSE;
		_g_object_unref0 (device);
		return result;
	}
	_tmp3_ = device;
	if (_tmp3_->capability_checked) {
		ProtonPlusUtilsSdlControllerHapticSinkDevice* _tmp4_;
		_tmp4_ = device;
		result = _tmp4_->rumble_supported;
		_g_object_unref0 (device);
		return result;
	}
	_tmp5_ = device;
	_tmp5_->capability_checked = TRUE;
	_tmp6_ = device;
	_tmp7_ = _tmp6_->gamepad;
	properties = SDL_GetGamepadProperties (_tmp7_);
	if (((guint32) properties) == ((guint32) 0)) {
		ProtonPlusUtilsSdlControllerHapticSinkDevice* _tmp8_;
		_tmp8_ = device;
		proton_plus_utils_sdl_controller_haptic_sink_report_failure_once (self, _tmp8_, "Unable to inspect controller rumble support");
		result = FALSE;
		_g_object_unref0 (device);
		return result;
	}
	_tmp9_ = device;
	_tmp9_->rumble_supported = SDL_GetBooleanProperty (properties, SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN, FALSE);
	_tmp10_ = device;
	result = _tmp10_->rumble_supported;
	_g_object_unref0 (device);
	return result;
}

static gboolean
proton_plus_utils_sdl_controller_haptic_sink_real_pulse (ProtonPlusUtilsControllerHapticSink* base,
                                                         gint64 device_id,
                                                         ProtonPlusUtilsControllerHapticPulse* pulse)
{
	ProtonPlusUtilsSdlControllerHapticSink * self;
	ProtonPlusUtilsSdlControllerHapticSinkDevice* device = NULL;
	GeeHashMap* _tmp0_;
	gpointer _tmp1_;
	gboolean _tmp2_ = FALSE;
	ProtonPlusUtilsSdlControllerHapticSinkDevice* _tmp3_;
	ProtonPlusUtilsSdlControllerHapticSinkDevice* _tmp4_;
	SDL_Gamepad* _tmp5_;
	guint16 _tmp6_;
	guint16 _tmp7_;
	guint16 _tmp8_;
	guint16 _tmp9_;
	guint32 _tmp10_;
	guint32 _tmp11_;
	ProtonPlusUtilsSdlControllerHapticSinkDevice* _tmp12_;
	ProtonPlusUtilsSdlControllerHapticSinkDevice* _tmp13_;
	gboolean result;
	self = (ProtonPlusUtilsSdlControllerHapticSink*) base;
	g_return_val_if_fail (pulse != NULL, FALSE);
	_tmp0_ = self->priv->devices;
	_tmp1_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp0_, &device_id);
	device = (ProtonPlusUtilsSdlControllerHapticSinkDevice*) _tmp1_;
	_tmp3_ = device;
	if (_tmp3_ == NULL) {
		_tmp2_ = TRUE;
	} else {
		_tmp2_ = !proton_plus_utils_controller_haptic_sink_supports_device ((ProtonPlusUtilsControllerHapticSink*) self, device_id);
	}
	if (_tmp2_) {
		result = FALSE;
		_g_object_unref0 (device);
		return result;
	}
	_tmp4_ = device;
	_tmp5_ = _tmp4_->gamepad;
	_tmp6_ = proton_plus_utils_controller_haptic_pulse_get_low_frequency_strength (pulse);
	_tmp7_ = _tmp6_;
	_tmp8_ = proton_plus_utils_controller_haptic_pulse_get_high_frequency_strength (pulse);
	_tmp9_ = _tmp8_;
	_tmp10_ = proton_plus_utils_controller_haptic_pulse_get_duration_ms (pulse);
	_tmp11_ = _tmp10_;
	if (SDL_RumbleGamepad (_tmp5_, _tmp7_, _tmp9_, _tmp11_)) {
		result = TRUE;
		_g_object_unref0 (device);
		return result;
	}
	_tmp12_ = device;
	_tmp12_->rumble_supported = FALSE;
	_tmp13_ = device;
	proton_plus_utils_sdl_controller_haptic_sink_report_failure_once (self, _tmp13_, "Controller rumble failed");
	result = FALSE;
	_g_object_unref0 (device);
	return result;
}

static void
proton_plus_utils_sdl_controller_haptic_sink_real_stop (ProtonPlusUtilsControllerHapticSink* base,
                                                        gint64 device_id)
{
	ProtonPlusUtilsSdlControllerHapticSink * self;
	ProtonPlusUtilsSdlControllerHapticSinkDevice* device = NULL;
	GeeHashMap* _tmp0_;
	gpointer _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	ProtonPlusUtilsSdlControllerHapticSinkDevice* _tmp4_;
	ProtonPlusUtilsSdlControllerHapticSinkDevice* _tmp7_;
	SDL_Gamepad* _tmp8_;
	self = (ProtonPlusUtilsSdlControllerHapticSink*) base;
	_tmp0_ = self->priv->devices;
	_tmp1_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp0_, &device_id);
	device = (ProtonPlusUtilsSdlControllerHapticSinkDevice*) _tmp1_;
	_tmp4_ = device;
	if (_tmp4_ == NULL) {
		_tmp3_ = TRUE;
	} else {
		ProtonPlusUtilsSdlControllerHapticSinkDevice* _tmp5_;
		_tmp5_ = device;
		_tmp3_ = !_tmp5_->capability_checked;
	}
	if (_tmp3_) {
		_tmp2_ = TRUE;
	} else {
		ProtonPlusUtilsSdlControllerHapticSinkDevice* _tmp6_;
		_tmp6_ = device;
		_tmp2_ = !_tmp6_->rumble_supported;
	}
	if (_tmp2_) {
		_g_object_unref0 (device);
		return;
	}
	_tmp7_ = device;
	_tmp8_ = _tmp7_->gamepad;
	if (!SDL_RumbleGamepad (_tmp8_, (guint16) 0, (guint16) 0, (guint32) 0)) {
		ProtonPlusUtilsSdlControllerHapticSinkDevice* _tmp9_;
		ProtonPlusUtilsSdlControllerHapticSinkDevice* _tmp10_;
		_tmp9_ = device;
		_tmp9_->rumble_supported = FALSE;
		_tmp10_ = device;
		proton_plus_utils_sdl_controller_haptic_sink_report_failure_once (self, _tmp10_, "Stopping controller rumble failed");
	}
	_g_object_unref0 (device);
}

static void
proton_plus_utils_sdl_controller_haptic_sink_report_failure_once (ProtonPlusUtilsSdlControllerHapticSink* self,
                                                                  ProtonPlusUtilsSdlControllerHapticSinkDevice* device,
                                                                  const gchar* message)
{
	const gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (device != NULL);
	g_return_if_fail (message != NULL);
	if (device->diagnostic_reported) {
		return;
	}
	device->diagnostic_reported = TRUE;
	_tmp0_ = SDL_GetError ();
	g_warning ("%s for device %" G_GINT64_FORMAT ": %s", message, device->id, _tmp0_);
}

ProtonPlusUtilsSdlControllerHapticSink*
proton_plus_utils_sdl_controller_haptic_sink_construct (GType object_type)
{
	ProtonPlusUtilsSdlControllerHapticSink * self = NULL;
	self = (ProtonPlusUtilsSdlControllerHapticSink*) g_object_new (object_type, NULL);
	return self;
}

ProtonPlusUtilsSdlControllerHapticSink*
proton_plus_utils_sdl_controller_haptic_sink_new (void)
{
	return proton_plus_utils_sdl_controller_haptic_sink_construct (PROTON_PLUS_UTILS_TYPE_SDL_CONTROLLER_HAPTIC_SINK);
}

static ProtonPlusUtilsSdlControllerHapticSinkDevice*
proton_plus_utils_sdl_controller_haptic_sink_device_construct (GType object_type,
                                                               gint64 id,
                                                               SDL_Gamepad* gamepad)
{
	ProtonPlusUtilsSdlControllerHapticSinkDevice * self = NULL;
	g_return_val_if_fail (gamepad != NULL, NULL);
	self = (ProtonPlusUtilsSdlControllerHapticSinkDevice*) g_object_new (object_type, NULL);
	self->id = id;
	self->gamepad = gamepad;
	return self;
}

static ProtonPlusUtilsSdlControllerHapticSinkDevice*
proton_plus_utils_sdl_controller_haptic_sink_device_new (gint64 id,
                                                         SDL_Gamepad* gamepad)
{
	return proton_plus_utils_sdl_controller_haptic_sink_device_construct (PROTON_PLUS_UTILS_SDL_CONTROLLER_HAPTIC_SINK_TYPE_DEVICE, id, gamepad);
}

static void
proton_plus_utils_sdl_controller_haptic_sink_device_class_init (ProtonPlusUtilsSdlControllerHapticSinkDeviceClass * klass,
                                                                gpointer klass_data)
{
	proton_plus_utils_sdl_controller_haptic_sink_device_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = proton_plus_utils_sdl_controller_haptic_sink_device_finalize;
}

static void
proton_plus_utils_sdl_controller_haptic_sink_device_instance_init (ProtonPlusUtilsSdlControllerHapticSinkDevice * self,
                                                                   gpointer klass)
{
	self->capability_checked = FALSE;
	self->rumble_supported = FALSE;
	self->diagnostic_reported = FALSE;
}

static void
proton_plus_utils_sdl_controller_haptic_sink_device_finalize (GObject * obj)
{
	ProtonPlusUtilsSdlControllerHapticSinkDevice * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_UTILS_SDL_CONTROLLER_HAPTIC_SINK_TYPE_DEVICE, ProtonPlusUtilsSdlControllerHapticSinkDevice);
	G_OBJECT_CLASS (proton_plus_utils_sdl_controller_haptic_sink_device_parent_class)->finalize (obj);
}

static GType
proton_plus_utils_sdl_controller_haptic_sink_device_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsSdlControllerHapticSinkDeviceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_sdl_controller_haptic_sink_device_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusUtilsSdlControllerHapticSinkDevice), 0, (GInstanceInitFunc) proton_plus_utils_sdl_controller_haptic_sink_device_instance_init, NULL };
	GType proton_plus_utils_sdl_controller_haptic_sink_device_type_id;
	proton_plus_utils_sdl_controller_haptic_sink_device_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusUtilsSdlControllerHapticSinkDevice", &g_define_type_info, 0);
	return proton_plus_utils_sdl_controller_haptic_sink_device_type_id;
}

static GType
proton_plus_utils_sdl_controller_haptic_sink_device_get_type (void)
{
	static volatile gsize proton_plus_utils_sdl_controller_haptic_sink_device_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_sdl_controller_haptic_sink_device_type_id__once)) {
		GType proton_plus_utils_sdl_controller_haptic_sink_device_type_id;
		proton_plus_utils_sdl_controller_haptic_sink_device_type_id = proton_plus_utils_sdl_controller_haptic_sink_device_get_type_once ();
		g_once_init_leave (&proton_plus_utils_sdl_controller_haptic_sink_device_type_id__once, proton_plus_utils_sdl_controller_haptic_sink_device_type_id);
	}
	return proton_plus_utils_sdl_controller_haptic_sink_device_type_id__once;
}

static void
proton_plus_utils_sdl_controller_haptic_sink_class_init (ProtonPlusUtilsSdlControllerHapticSinkClass * klass,
                                                         gpointer klass_data)
{
	proton_plus_utils_sdl_controller_haptic_sink_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &ProtonPlusUtilsSdlControllerHapticSink_private_offset);
	G_OBJECT_CLASS (klass)->finalize = proton_plus_utils_sdl_controller_haptic_sink_finalize;
}

static void
proton_plus_utils_sdl_controller_haptic_sink_proton_plus_utils_controller_haptic_sink_interface_init (ProtonPlusUtilsControllerHapticSinkIface * iface,
                                                                                                      gpointer iface_data)
{
	proton_plus_utils_sdl_controller_haptic_sink_proton_plus_utils_controller_haptic_sink_parent_iface = g_type_interface_peek_parent (iface);
	iface->supports_device = (gboolean (*) (ProtonPlusUtilsControllerHapticSink*, gint64)) proton_plus_utils_sdl_controller_haptic_sink_real_supports_device;
	iface->pulse = (gboolean (*) (ProtonPlusUtilsControllerHapticSink*, gint64, ProtonPlusUtilsControllerHapticPulse*)) proton_plus_utils_sdl_controller_haptic_sink_real_pulse;
	iface->stop = (void (*) (ProtonPlusUtilsControllerHapticSink*, gint64)) proton_plus_utils_sdl_controller_haptic_sink_real_stop;
}

static void
proton_plus_utils_sdl_controller_haptic_sink_instance_init (ProtonPlusUtilsSdlControllerHapticSink * self,
                                                            gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = proton_plus_utils_sdl_controller_haptic_sink_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (G_TYPE_INT64, (GBoxedCopyFunc) _int64_dup, (GDestroyNotify) g_free, PROTON_PLUS_UTILS_SDL_CONTROLLER_HAPTIC_SINK_TYPE_DEVICE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->devices = _tmp0_;
}

static void
proton_plus_utils_sdl_controller_haptic_sink_finalize (GObject * obj)
{
	ProtonPlusUtilsSdlControllerHapticSink * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_UTILS_TYPE_SDL_CONTROLLER_HAPTIC_SINK, ProtonPlusUtilsSdlControllerHapticSink);
	_g_object_unref0 (self->priv->devices);
	G_OBJECT_CLASS (proton_plus_utils_sdl_controller_haptic_sink_parent_class)->finalize (obj);
}

static GType
proton_plus_utils_sdl_controller_haptic_sink_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsSdlControllerHapticSinkClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_sdl_controller_haptic_sink_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusUtilsSdlControllerHapticSink), 0, (GInstanceInitFunc) proton_plus_utils_sdl_controller_haptic_sink_instance_init, NULL };
	static const GInterfaceInfo proton_plus_utils_controller_haptic_sink_info = { (GInterfaceInitFunc) proton_plus_utils_sdl_controller_haptic_sink_proton_plus_utils_controller_haptic_sink_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType proton_plus_utils_sdl_controller_haptic_sink_type_id;
	proton_plus_utils_sdl_controller_haptic_sink_type_id = g_type_register_static (G_TYPE_OBJECT, "ProtonPlusUtilsSdlControllerHapticSink", &g_define_type_info, 0);
	g_type_add_interface_static (proton_plus_utils_sdl_controller_haptic_sink_type_id, PROTON_PLUS_UTILS_TYPE_CONTROLLER_HAPTIC_SINK, &proton_plus_utils_controller_haptic_sink_info);
	ProtonPlusUtilsSdlControllerHapticSink_private_offset = g_type_add_instance_private (proton_plus_utils_sdl_controller_haptic_sink_type_id, sizeof (ProtonPlusUtilsSdlControllerHapticSinkPrivate));
	return proton_plus_utils_sdl_controller_haptic_sink_type_id;
}

GType
proton_plus_utils_sdl_controller_haptic_sink_get_type (void)
{
	static volatile gsize proton_plus_utils_sdl_controller_haptic_sink_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_sdl_controller_haptic_sink_type_id__once)) {
		GType proton_plus_utils_sdl_controller_haptic_sink_type_id;
		proton_plus_utils_sdl_controller_haptic_sink_type_id = proton_plus_utils_sdl_controller_haptic_sink_get_type_once ();
		g_once_init_leave (&proton_plus_utils_sdl_controller_haptic_sink_type_id__once, proton_plus_utils_sdl_controller_haptic_sink_type_id);
	}
	return proton_plus_utils_sdl_controller_haptic_sink_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

