Skip to content

Commit

Permalink
add retrorun for rockchip
Browse files Browse the repository at this point in the history
  • Loading branch information
stolen committed Nov 28, 2024
1 parent 6192475 commit 095e4e6
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/emulators/libretro/retrorun/package.mk
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -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 <dirent.h>
#include <stdbool.h>
#include <pthread.h>
+#include <glob.h>

-#include <libevdev-1.0/libevdev/libevdev.h>
+#include <libevdev/libevdev.h>
#include <linux/limits.h>

#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
+}
4 changes: 4 additions & 0 deletions packages/virtual/emulators/package.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 095e4e6

Please sign in to comment.