diff --git a/packages/emulators/libretro/retrorun/package.mk b/packages/emulators/libretro/retrorun/package.mk new file mode 100644 index 000000000..143b0f84d --- /dev/null +++ b/packages/emulators/libretro/retrorun/package.mk @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2021-2024 Shanti Gilbert (https://github.com/shantigilbert) +# Copyright (C) 2024 ROCKNIX (https://github.com/ROCKNIX) + +PKG_NAME="retrorun" +PKG_VERSION="95ac0bf3a921beefee8b3bbf2faf89eef18f9b3a" +PKG_LICENSE="GPLv2" +PKG_SITE="https://github.com/navy1978/retrorun" +PKG_URL="${PKG_SITE}/archive/${PKG_VERSION}.zip" +PKG_DEPENDS_TARGET="toolchain librga libdrm" +PKG_TOOLCHAIN="make" + +pre_configure_target() { + PKG_MAKE_OPTS_TARGET=" config=release ARCH=" +} + +makeinstall_target() { + mkdir -p $INSTALL/usr/bin + cp retrorun $INSTALL/usr/bin +} diff --git a/packages/emulators/libretro/retrorun/patches/001-fix-joystick-discovery.patch b/packages/emulators/libretro/retrorun/patches/001-fix-joystick-discovery.patch new file mode 100644 index 000000000..fa150dadb --- /dev/null +++ b/packages/emulators/libretro/retrorun/patches/001-fix-joystick-discovery.patch @@ -0,0 +1,62 @@ +--- retrorun-95ac0bf3a921beefee8b3bbf2faf89eef18f9b3a/src/go2/input.cpp.orig 2024-04-11 22:22:16.000000000 +0000 ++++ retrorun-95ac0bf3a921beefee8b3bbf2faf89eef18f9b3a/src/go2/input.cpp 2024-11-25 20:43:30.141283197 +0000 +@@ -34,16 +34,15 @@ + #include + #include + #include ++#include + +-#include ++#include + #include + + #define BATTERY_BUFFER_SIZE (128) + #define BRIGHTNESS_BUFFER_SIZE (128) + // joypad +-static const char *EVDEV_NAME = "/dev/input/by-path/platform-odroidgo2-joypad-event-joystick"; +-static const char *EVDEV_NAME_2 = "/dev/input/by-path/platform-odroidgo3-joypad-event-joystick"; +-static const char* EVDEV_NAME_3 = "/dev/input/by-path/platform-singleadc-joypad-event-joystick"; ++static const char *EVDEV_WILDCARD = "/dev/input/by-path/platform-*-joypad-event-joystick"; + // battery + static const char *BATTERY_STATUS_NAME = "/sys/class/power_supply/battery/status"; + static const char *BATTERY_CAPACITY_NAME = "/sys/class/power_supply/battery/capacity"; +@@ -431,6 +430,7 @@ + { + + int rc = 1; ++ glob_t globbuf; + + go2_input_t *result = (go2_input_t *)malloc(sizeof(*result)); + if (!result) +@@ -443,18 +443,12 @@ + + result->device = device; + +- result->fd = open(EVDEV_NAME, O_RDONLY); +- if (result->fd < 0) +- { +- if (isRG503()){ +- result->fd = open(EVDEV_NAME_3, O_RDONLY); +- }else{ +- result->fd = open(EVDEV_NAME_2, O_RDONLY); +- } +- if (result->fd < 0) +- { +- printf("Joystick: No gamepad found.\n"); +- } ++ rc = glob(EVDEV_WILDCARD, 0, NULL, &globbuf); ++ if (rc != 0) { ++ printf("Joystick: Failed to find device %s %d\n", EVDEV_WILDCARD, rc); ++ result->fd = -1; ++ } else { ++ result->fd = open(*globbuf.gl_pathv, O_RDONLY); + } + + if (result->fd > -1) +@@ -663,4 +657,4 @@ + go2_thumb_t go2_input_state_thumbstick_get(go2_input_state_t *state, go2_input_thumbstick_t thumbstick) + { + return state->thumbs[thumbstick]; +-} +\ No newline at end of file ++} diff --git a/packages/virtual/emulators/package.mk b/packages/virtual/emulators/package.mk index 9a87a2262..b2ddd37e8 100644 --- a/packages/virtual/emulators/package.mk +++ b/packages/virtual/emulators/package.mk @@ -81,6 +81,10 @@ case "${DEVICE}" in ;; esac +if [ "${PROJECT}" = "Rockchip" ]; then + PKG_DEPENDS_TARGET+=" retrorun" +fi + PKG_DEPENDS_TARGET+=" ${PKG_EMUS} ${EMUS_32BIT} ${PKG_RETROARCH} ${LIBRETRO_CORES}" install_script() {