Files
RetroArch/samples/input/sensor_subdevice/Makefile
LibretroAdmin 80b3aefa35 input: a controller's sub-device sensors, from SDL's left-hand sensors
The frontend passes a core's sensor calls for a sub-device
(RETRO_SENSOR_SUBDEVICE) on to the drivers with the index kept. It
remembers which sub-device sensors the core enabled, as it does the
controller's own, so one not enabled, or whose enable no driver took,
reads 0 without asking a driver. The controller's own sensors are
handled as before, and sensitivity and orientation apply to both; the
profile's axis remap stays the controller's.

The SDL2 (2.26 and up) and SDL3 joypad drivers answer sub-device 1 from
SDL's _L sensors: a Wii Remote's Nunchuk accelerometer, the left
Joy-Con of a pair. SDL3 restores it on a reconnect as it does the
others. Every other driver already refuses an index it does not know.

samples/input/sensor_subdevice runs the wrappers as they ship.
2026-10-28 16:37:08 +01:00

22 lines
847 B
Makefile

ROOT := ../../..
TARGET := sensor_subdevice_test
CC ?= cc
# The frontend's core sensor wrappers, extracted from input_driver.c
# between their markers, so the test runs the shipping code.
CFLAGS += -std=gnu99 -O1 -g1 -Wall -DRARCH_INTERNAL \
-I. -I$(ROOT) -I$(ROOT)/libretro-common/include -I$(ROOT)/deps
ifneq ($(SANITIZER),)
CFLAGS += -fsanitize=$(SANITIZER) -fno-omit-frame-pointer
LDFLAGS += -fsanitize=$(SANITIZER)
endif
all: $(TARGET)
core_sensor_fragment.c: $(ROOT)/input/input_driver.c
sed -n '/===== BEGIN input core sensor wrappers =====/,/===== END input core sensor wrappers =====/p' $< > $@
$(TARGET): sensor_subdevice_test.c core_sensor_fragment.c
$(CC) $(CFLAGS) -o $@ sensor_subdevice_test.c $(LDFLAGS)
check: all
./$(TARGET)
clean:
rm -f $(TARGET) $(TARGET).exe core_sensor_fragment.c
.PHONY: all check clean