From 9b7c0cb64344125f0ebe7b2405d0c3cc200d0c24 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Thu, 14 Sep 2023 17:39:40 +0300
Subject: [PATCH] fix build.
---
src/sdl2_compat.c | 18 ++++++++++--------
src/sdl2_compat.h | 8 +-------
2 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index 40cd2a0..df5302e 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -6030,20 +6030,21 @@ SDL_GameControllerGetBindForAxis(SDL_GameController *controller,
int i;
for (i = 0; bindings[i]; ++i) {
SDL_GamepadBinding *binding = bindings[i];
- if (binding->outputType == SDL_CONTROLLER_BINDTYPE_AXIS && binding->output.axis.axis == axis) {
+ if (binding->outputType == SDL_GAMEPAD_BINDTYPE_AXIS && binding->output.axis.axis == axis) {
bind.bindType = binding->inputType;
- if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS) {
+ if (binding->inputType == SDL_GAMEPAD_BINDTYPE_AXIS) {
/* FIXME: There might be multiple axes bound now that we have axis ranges... */
bind.value.axis = binding->input.axis.axis;
- } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON) {
+ } else if (binding->inputType == SDL_GAMEPAD_BINDTYPE_BUTTON) {
bind.value.button = binding->input.button;
- } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT) {
+ } else if (binding->inputType == SDL_GAMEPAD_BINDTYPE_HAT) {
bind.value.hat.hat = binding->input.hat.hat;
bind.value.hat.hat_mask = binding->input.hat.hat_mask;
}
break;
}
}
+
SDL_free(bindings);
}
}
@@ -6065,19 +6066,20 @@ SDL_GameControllerGetBindForButton(SDL_GameController *controller,
int i;
for (i = 0; bindings[i]; ++i) {
SDL_GamepadBinding *binding = bindings[i];
- if (binding->outputType == SDL_CONTROLLER_BINDTYPE_BUTTON && binding->output.button == button) {
+ if (binding->outputType == SDL_GAMEPAD_BINDTYPE_BUTTON && binding->output.button == button) {
bind.bindType = binding->inputType;
- if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS) {
+ if (binding->inputType == SDL_GAMEPAD_BINDTYPE_AXIS) {
bind.value.axis = binding->input.axis.axis;
- } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON) {
+ } else if (binding->inputType == SDL_GAMEPAD_BINDTYPE_BUTTON) {
bind.value.button = binding->input.button;
- } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT) {
+ } else if (binding->inputType == SDL_GAMEPAD_BINDTYPE_HAT) {
bind.value.hat.hat = binding->input.hat.hat;
bind.value.hat.hat_mask = binding->input.hat.hat_mask;
}
break;
}
}
+
SDL_free(bindings);
}
}
diff --git a/src/sdl2_compat.h b/src/sdl2_compat.h
index 1a08097..6259442 100644
--- a/src/sdl2_compat.h
+++ b/src/sdl2_compat.h
@@ -30,13 +30,7 @@ typedef SDL_Condition SDL_cond;
typedef SDL_Mutex SDL_mutex;
typedef SDL_Semaphore SDL_sem;
-typedef enum
-{
- SDL_CONTROLLER_BINDTYPE_NONE = 0,
- SDL_CONTROLLER_BINDTYPE_BUTTON,
- SDL_CONTROLLER_BINDTYPE_AXIS,
- SDL_CONTROLLER_BINDTYPE_HAT
-} SDL_GameControllerBindType;
+typedef SDL_GamepadBindingType SDL_GameControllerBindType;
typedef struct SDL_GameControllerButtonBind
{