Skip to content

Commit

Permalink
Ports: Add RetroArch
Browse files Browse the repository at this point in the history
  • Loading branch information
gouchi authored and linusg committed May 25, 2022
1 parent 78dc77f commit 74226a6
Show file tree
Hide file tree
Showing 9 changed files with 1,268 additions and 0 deletions.
1 change: 1 addition & 0 deletions Ports/AvailablePorts.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^
| [`vlang`](vlang/) | V programming language | weekly.2021.31 | https://github.com/vlang/v |
| [`radare2`](radare2/) | radare2 reverse engineering framework | 5.4.0-git | https://github.com/radareorg/radare2 |
| [`readline`](readline/) | GNU Readline Library | 8.1.2 | https://tiswww.case.edu/php/chet/readline/rltop.html |
| [`RetroArch`](RetroArch/) | RetroArch | 1.10.3 | https://www.retroarch.com |
| [`RISCVEmu`](RISCVEmu/) | A Basic C++ RISC-V Emulator | ad8ad6a | https://github.com/IdanHo/RISCVEmu |
| [`rsync`](rsync/) | rsync | 3.1.3 | https://rsync.samba.org/ |
| [`ruby`](ruby/) | Ruby | 3.0.4 | https://www.ruby-lang.org/ |
Expand Down
35 changes: 35 additions & 0 deletions Ports/RetroArch/package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env -S bash ../.port_include.sh
port=RetroArch
useconfigure="true"
version="1.10.3"
archive_hash="2af44294e55f5636262284d650cb5fff55c9070ac3a700d4fa55c1f152dcb3f2"
files="https://github.com/libretro/${port}/archive/refs/tags/v${version}.tar.gz ${port}-${version}.tar.gz $archive_hash"
auth_type=sha256
depends=("freetype" "SDL2" "zlib")

configopts=(
"--disable-builtinglslang"
"--disable-discord"
"--disable-glsl"
"--disable-glslang"
"--disable-opengl"
"--disable-slang"
"--disable-spirv_cross"
"--disable-systemmbedtls"
"--disable-update_cores"
)

launcher_name=RetroArch
launcher_category=Games
launcher_command=/usr/local/bin/retroarch
icon_file=media/retroarch.ico

export CFLAGS="-I${SERENITY_INSTALL_ROOT}/usr/include/LibGL -I${SERENITY_INSTALL_ROOT}/usr/local/include/SDL2"

post_install() {
echo "==== Post installation instructions ===="
echo "Please remember to use the online updater"
echo "to install cores info files using main menu"
echo "online updater > update core info files"
echo "before installing libretro cores from the port"
}
32 changes: 32 additions & 0 deletions Ports/RetroArch/patches/0001-Add-SerenityOS-platform.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From 53eae76554d4e4629fc1568cec785b644bde1f86 Mon Sep 17 00:00:00 2001
From: gouchi <[email protected]>
Date: Sat, 7 May 2022 18:19:42 +0200
Subject: [PATCH 1/6] Add SerenityOS platform

---
qb/qb.system.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/qb/qb.system.sh b/qb/qb.system.sh
index c7ac141..f7f198d 100644
--- a/qb/qb.system.sh
+++ b/qb/qb.system.sh
@@ -1,5 +1,5 @@
-PLATFORM_NAME="$(uname -s)"
-ARCHITECTURE_NAME="$(uname -m)"
+PLATFORM_NAME="SerenityOS"
+ARCHITECTURE_NAME="${SERENITY_ARCH}"

if [ -n "${CROSS_COMPILE:=}" ]; then
case "$CROSS_COMPILE" in
@@ -18,6 +18,7 @@ if [ -z "$CROSS_COMPILE" ] || [ -z "$OS" ]; then
'Haiku') OS='Haiku';;
'MINGW'*) OS='Win32';;
'SunOS') OS='SunOS';;
+ 'SerenityOS') OS='SerenityOS';;
*) OS="Win32";;
esac
fi
--
2.36.0

25 changes: 25 additions & 0 deletions Ports/RetroArch/patches/0002-Find-libgl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From d65b301e331c52fd78a1b0205e4b3630a6200950 Mon Sep 17 00:00:00 2001
From: gouchi <[email protected]>
Date: Sat, 7 May 2022 18:20:09 +0200
Subject: [PATCH 2/6] Find libgl

---
qb/config.libs.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qb/config.libs.sh b/qb/config.libs.sh
index 19cd2a6..672fb02 100644
--- a/qb/config.libs.sh
+++ b/qb/config.libs.sh
@@ -402,7 +402,7 @@ if [ "$HAVE_OPENGL" != 'no' ] && [ "$HAVE_OPENGLES" != 'yes' ]; then
check_lib '' OPENGL -lopengl32
else
check_header '' OPENGL "GL/gl.h"
- check_lib '' OPENGL -lGL
+ check_lib '' OPENGL -lgl
fi

if [ "$HAVE_OPENGL" = 'yes' ]; then
--
2.36.0

27 changes: 27 additions & 0 deletions Ports/RetroArch/patches/0003-Add-strlcat.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 05fc282bdbe985fb77d746003ce213012a0292f8 Mon Sep 17 00:00:00 2001
From: gouchi <[email protected]>
Date: Sat, 7 May 2022 18:20:35 +0200
Subject: [PATCH 3/6] Add strlcat()

---
Makefile.common | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/Makefile.common b/Makefile.common
index 580beba..dbfbd39 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -186,6 +186,10 @@ ifneq ($(findstring Linux,$(OS)),)
HAVE_UNIX = 1
endif

+ifneq ($(findstring SerenityOS,$(OS)),)
+ OBJ += $(LIBRETRO_COMM_DIR)/compat/compat_strl.o
+endif
+
ifeq ($(HAVE_UNIX), 1)
OBJ += frontend/drivers/platform_unix.o

--
2.36.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 365f17fb8bb303608d351f3a91219256746cdc60 Mon Sep 17 00:00:00 2001
From: gouchi <[email protected]>
Date: Sat, 7 May 2022 18:20:52 +0200
Subject: [PATCH 4/6] Disable pthread_attr_setschedpolicy()

---
libretro-common/rthreads/rthreads.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libretro-common/rthreads/rthreads.c b/libretro-common/rthreads/rthreads.c
index 30ec6ff..08c8a96 100644
--- a/libretro-common/rthreads/rthreads.c
+++ b/libretro-common/rthreads/rthreads.c
@@ -161,7 +161,7 @@ sthread_t *sthread_create(void (*thread_func)(void*), void *userdata)
}

/* TODO/FIXME - this needs to be implemented for Switch/3DS */
-#if !defined(SWITCH) && !defined(USE_WIN32_THREADS) && !defined(_3DS) && !defined(GEKKO) && !defined(__HAIKU__) && !defined(EMSCRIPTEN)
+#if !defined(SWITCH) && !defined(USE_WIN32_THREADS) && !defined(_3DS) && !defined(GEKKO) && !defined(__HAIKU__) && !defined(EMSCRIPTEN) && !defined(__serenity__)
#define HAVE_THREAD_ATTR
#endif

--
2.36.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 8494fc6dbd6abc799a2eb02933103361ea0202b0 Mon Sep 17 00:00:00 2001
From: gouchi <[email protected]>
Date: Sat, 7 May 2022 18:21:50 +0200
Subject: [PATCH 5/6] Use SDL software instead of hardware rendering

---
gfx/drivers/sdl2_gfx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gfx/drivers/sdl2_gfx.c b/gfx/drivers/sdl2_gfx.c
index 4dbe33f..dd67b4a 100644
--- a/gfx/drivers/sdl2_gfx.c
+++ b/gfx/drivers/sdl2_gfx.c
@@ -182,7 +182,7 @@ static void sdl2_render_msg(sdl2_video_t *vid, const char *msg)

static void sdl2_init_renderer(sdl2_video_t *vid)
{
- unsigned flags = SDL_RENDERER_ACCELERATED;
+ unsigned flags = SDL_RENDERER_SOFTWARE;

if (vid->video.vsync)
flags |= SDL_RENDERER_PRESENTVSYNC;
--
2.36.0

Loading

0 comments on commit 74226a6

Please sign in to comment.