mirror of
https://github.com/open-goal/jak-project
synced 2026-08-18 05:48:28 -04:00
deps: SDL update to 2.30.0 (#3384)
In the hopes that some things have been fixed in the last year (GAME_CONTROLLER init time, etc) Make sure this does not regress #2691
This commit is contained in:
+20
-33
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -32,10 +32,9 @@
|
||||
#include "SDL_androidsensor.h"
|
||||
#include "../SDL_syssensor.h"
|
||||
#include "../SDL_sensor_c.h"
|
||||
//#include "../../core/android/SDL_android.h"
|
||||
|
||||
#ifndef LOOPER_ID_USER
|
||||
#define LOOPER_ID_USER 3
|
||||
#define LOOPER_ID_USER 3
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
@@ -44,13 +43,12 @@ typedef struct
|
||||
SDL_SensorID instance_id;
|
||||
} SDL_AndroidSensor;
|
||||
|
||||
static ASensorManager* SDL_sensor_manager;
|
||||
static ALooper* SDL_sensor_looper;
|
||||
static ASensorManager *SDL_sensor_manager;
|
||||
static ALooper *SDL_sensor_looper;
|
||||
static SDL_AndroidSensor *SDL_sensors;
|
||||
static int SDL_sensors_count;
|
||||
|
||||
static int
|
||||
SDL_ANDROID_SensorInit(void)
|
||||
static int SDL_ANDROID_SensorInit(void)
|
||||
{
|
||||
int i, sensors_count;
|
||||
ASensorList sensors;
|
||||
@@ -85,25 +83,21 @@ SDL_ANDROID_SensorInit(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
SDL_ANDROID_SensorGetCount(void)
|
||||
static int SDL_ANDROID_SensorGetCount(void)
|
||||
{
|
||||
return SDL_sensors_count;
|
||||
}
|
||||
|
||||
static void
|
||||
SDL_ANDROID_SensorDetect(void)
|
||||
static void SDL_ANDROID_SensorDetect(void)
|
||||
{
|
||||
}
|
||||
|
||||
static const char *
|
||||
SDL_ANDROID_SensorGetDeviceName(int device_index)
|
||||
static const char *SDL_ANDROID_SensorGetDeviceName(int device_index)
|
||||
{
|
||||
return ASensor_getName(SDL_sensors[device_index].asensor);
|
||||
}
|
||||
|
||||
static SDL_SensorType
|
||||
SDL_ANDROID_SensorGetDeviceType(int device_index)
|
||||
static SDL_SensorType SDL_ANDROID_SensorGetDeviceType(int device_index)
|
||||
{
|
||||
switch (ASensor_getType(SDL_sensors[device_index].asensor)) {
|
||||
case 0x00000001:
|
||||
@@ -115,26 +109,23 @@ SDL_ANDROID_SensorGetDeviceType(int device_index)
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
SDL_ANDROID_SensorGetDeviceNonPortableType(int device_index)
|
||||
static int SDL_ANDROID_SensorGetDeviceNonPortableType(int device_index)
|
||||
{
|
||||
return ASensor_getType(SDL_sensors[device_index].asensor);
|
||||
}
|
||||
|
||||
static SDL_SensorID
|
||||
SDL_ANDROID_SensorGetDeviceInstanceID(int device_index)
|
||||
static SDL_SensorID SDL_ANDROID_SensorGetDeviceInstanceID(int device_index)
|
||||
{
|
||||
return SDL_sensors[device_index].instance_id;
|
||||
}
|
||||
|
||||
static int
|
||||
SDL_ANDROID_SensorOpen(SDL_Sensor *sensor, int device_index)
|
||||
static int SDL_ANDROID_SensorOpen(SDL_Sensor *sensor, int device_index)
|
||||
{
|
||||
struct sensor_hwdata *hwdata;
|
||||
int delay_us, min_delay_us;
|
||||
|
||||
hwdata = (struct sensor_hwdata *)SDL_calloc(1, sizeof(*hwdata));
|
||||
if (hwdata == NULL) {
|
||||
if (!hwdata) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
@@ -163,15 +154,14 @@ SDL_ANDROID_SensorOpen(SDL_Sensor *sensor, int device_index)
|
||||
sensor->hwdata = hwdata;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
SDL_ANDROID_SensorUpdate(SDL_Sensor *sensor)
|
||||
|
||||
static void SDL_ANDROID_SensorUpdate(SDL_Sensor *sensor)
|
||||
{
|
||||
int events;
|
||||
ASensorEvent event;
|
||||
struct android_poll_source* source;
|
||||
struct android_poll_source *source;
|
||||
|
||||
if (ALooper_pollAll(0, NULL, &events, (void**)&source) == LOOPER_ID_USER) {
|
||||
if (ALooper_pollAll(0, NULL, &events, (void **)&source) == LOOPER_ID_USER) {
|
||||
SDL_zero(event);
|
||||
while (ASensorEventQueue_getEvents(sensor->hwdata->eventqueue, &event, 1) > 0) {
|
||||
SDL_PrivateSensorUpdate(sensor, 0, event.data, SDL_arraysize(event.data));
|
||||
@@ -179,8 +169,7 @@ SDL_ANDROID_SensorUpdate(SDL_Sensor *sensor)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
SDL_ANDROID_SensorClose(SDL_Sensor *sensor)
|
||||
static void SDL_ANDROID_SensorClose(SDL_Sensor *sensor)
|
||||
{
|
||||
if (sensor->hwdata) {
|
||||
ASensorEventQueue_disableSensor(sensor->hwdata->eventqueue, sensor->hwdata->asensor);
|
||||
@@ -190,8 +179,7 @@ SDL_ANDROID_SensorClose(SDL_Sensor *sensor)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
SDL_ANDROID_SensorQuit(void)
|
||||
static void SDL_ANDROID_SensorQuit(void)
|
||||
{
|
||||
if (SDL_sensors) {
|
||||
SDL_free(SDL_sensors);
|
||||
@@ -200,8 +188,7 @@ SDL_ANDROID_SensorQuit(void)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_SensorDriver SDL_ANDROID_SensorDriver =
|
||||
{
|
||||
SDL_SensorDriver SDL_ANDROID_SensorDriver = {
|
||||
SDL_ANDROID_SensorInit,
|
||||
SDL_ANDROID_SensorGetCount,
|
||||
SDL_ANDROID_SensorDetect,
|
||||
|
||||
+1
-2
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -27,5 +27,4 @@ struct sensor_hwdata
|
||||
ASensorEventQueue *eventqueue;
|
||||
};
|
||||
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
||||
Reference in New Issue
Block a user