Files
RetroArch/samples/input/ps3_joypad/Makefile
LibretroAdmin 6de0fb0aad Console joypad drivers: a pad that stops reporting lets go of its sticks
Every console joypad driver now takes stick values only from a report
that carries them, and a pad that is gone, unreadable, or of a kind the
driver does not read holds nothing and reads centred:

- PSP: a failed read is skipped as on Vita.
- PS3: a disconnected pad's sticks are centred. Rumble keeps each
  pad's motor values and sends both, so setting one leaves the other
  as it was; the large motor scales across its 0-255 range.
- PS4: a report is read only from a pad reporting itself connected; the
  handle is kept for when it reports again.
- GameCube/Wii (libogc): sticks are centred before each pad is read, so
  a pad pulled out, a bare Wiimote or a Nunchuk in place of a Classic
  leaves nothing held.
- Switch: a lone Joy-Con centres the right stick.
- Wii U Wiimote: a device type the driver does not read holds nothing.
- Original Xbox: the device handle is kept across polls, a pad that
  cannot be read or is removed holds nothing, handles are closed before
  the state is cleared, and the X button case is terminated.

The PSP read macro evaluates its port argument, and the touched files
are MSVC C89 clean (INLINE, no trailing enum comma, unsigned for uint).

samples/input psp_pad_read, ps3_joypad, ps4_joypad, gx_pad_sticks,
switch_joypad, wiiu_kpad and xdk_joypad build each driver against
stand-ins for its SDK and hold it to the above: a stick held when the
pad goes away, changes extension or fails a read reads centred, and
PS3 rumble sets one motor without disturbing the other. The PS3
and PS4 stand-ins are added to tools/platform_stubs.
2026-10-13 17:00:12 +02:00

34 lines
974 B
Makefile

# The PS3 joypad driver (the PSL1GHT build), against the tree's PS3 stubs,
# with the pad calls defined by the test, which includes the driver's
# source itself.
TARGET := ps3_joypad_test
RARCH_DIR := ../../..
LIBRETRO_COMM_DIR := $(RARCH_DIR)/libretro-common
CFLAGS += -Wall -std=gnu99 -g1 -O1 -DRARCH_INTERNAL -D__PS3__ -D__PSL1GHT__ \
-I$(RARCH_DIR)/tools/platform_stubs/ps3 \
-I$(RARCH_DIR) -I$(LIBRETRO_COMM_DIR)/include
ifneq ($(SANITIZER),)
CFLAGS := -fsanitize=$(SANITIZER) -fno-omit-frame-pointer $(CFLAGS)
LDFLAGS := -fsanitize=$(SANITIZER) $(LDFLAGS)
endif
ifneq ($(SAN),)
CFLAGS := -fsanitize=$(SAN) -fno-omit-frame-pointer $(CFLAGS)
LDFLAGS := -fsanitize=$(SAN) $(LDFLAGS)
endif
all: $(TARGET)
$(TARGET): ps3_joypad_test.c $(RARCH_DIR)/input/drivers_joypad/ps3_joypad.c
$(CC) $(CFLAGS) -o $@ ps3_joypad_test.c $(LDFLAGS)
check: all
./$(TARGET)
clean:
rm -f $(TARGET) $(TARGET).exe
.PHONY: all check clean