retroarchBare: backport patches from upstream

This commit is contained in:
Thiago Kenji Okada 2022-12-23 21:46:49 +00:00
parent 61ffb5da59
commit 1aacb258cb
4 changed files with 51 additions and 113 deletions

View File

@ -10,6 +10,7 @@
, alsa-lib , alsa-lib
, dbus , dbus
, fetchFromGitHub , fetchFromGitHub
, fetchpatch
, ffmpeg_4 , ffmpeg_4
, flac , flac
, freetype , freetype
@ -57,16 +58,18 @@ stdenv.mkDerivation rec {
rev = "v${version}"; rev = "v${version}";
}; };
patches = lib.optional withAssets patches = [
(substituteAll { ./use-default-values-for-libretro_info_path-assets_directory.patch
src = ./move-retroarch-assets-to-retroarch_assets_path.patch; # TODO: remove those two patches in the next RetroArch release
retroarch_assets_path = retroarch-assets; (fetchpatch {
url = "https://github.com/libretro/RetroArch/commit/894c44c5ea7f1eada9207be3c29e8d5c0a7a9e1f.patch";
hash = "sha256-ThB6jd9pmsipT8zjehz7znK/s0ofHHCJeEYBKur6sO8=";
}) })
++ lib.optional withCoreInfo (fetchpatch {
(substituteAll { url = "https://github.com/libretro/RetroArch/commit/c5bfd52159cf97312bb28fc42203c39418d1bbbd.patch";
src = ./use-fixed-path-for-libretro_core_info.patch; hash = "sha256-rb1maAvCSUgq2VtJ67iqUY+Fz00Fchl8YGG0EPm0+F0=";
libretro_info_path = libretro-core-info; })
}); ];
nativeBuildInputs = [ pkg-config ] ++ nativeBuildInputs = [ pkg-config ] ++
lib.optional withWayland wayland ++ lib.optional withWayland wayland ++
@ -113,9 +116,11 @@ stdenv.mkDerivation rec {
] ++ ] ++
lib.optionals withAssets [ lib.optionals withAssets [
"--disable-update_assets" "--disable-update_assets"
# TODO: investigate why we also need this patch: "--with-assets_dir=${retroarch-assets}/share"
# ./move-retroarch-assets-to-retroarch_assets_path.patch ] ++
"--with-assets_dir=${retroarch-assets}" lib.optionals withCoreInfo [
"--disable-update_core_info"
"--with-core_info_dir=${libretro-core-info}/share"
] ++ ] ++
lib.optionals stdenv.isLinux [ lib.optionals stdenv.isLinux [
"--enable-dbus" "--enable-dbus"

View File

@ -1,60 +0,0 @@
From b3ccf05014f4a79800d8bed05b0dcfdc010e191c Mon Sep 17 00:00:00 2001
From: Thiago Kenji Okada <thiagokokada@gmail.com>
Date: Sun, 18 Dec 2022 22:06:48 +0000
Subject: [PATCH 2/2] Move retroarch assets path to @retroarch_assets_path@
---
configuration.c | 2 +-
frontend/drivers/platform_unix.c | 16 ++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/configuration.c b/configuration.c
index 06a99236c2..15b575d8a2 100644
--- a/configuration.c
+++ b/configuration.c
@@ -1539,7 +1539,7 @@ static struct config_path_setting *populate_settings_path(
SETTING_PATH("core_assets_directory",
settings->paths.directory_core_assets, true, NULL, true);
SETTING_PATH("assets_directory",
- settings->paths.directory_assets, true, NULL, true);
+ settings->paths.directory_assets, true, NULL, false);
SETTING_PATH("dynamic_wallpapers_directory",
settings->paths.directory_dynamic_wallpapers, true, NULL, true);
SETTING_PATH("thumbnails_directory",
diff --git a/frontend/drivers/platform_unix.c b/frontend/drivers/platform_unix.c
index 43ea5f80c9..01b6cccbcc 100644
--- a/frontend/drivers/platform_unix.c
+++ b/frontend/drivers/platform_unix.c
@@ -1778,21 +1778,21 @@ static void frontend_unix_get_env(int *argc,
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG], base_path,
"autoconfig", sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG]));
- if (path_is_directory("/usr/local/share/retroarch/assets"))
+ if (path_is_directory("@retroarch_assets_path@/local/share/retroarch/assets"))
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS],
- "/usr/local/share/retroarch",
+ "@retroarch_assets_path@/local/share/retroarch",
"assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
- else if (path_is_directory("/usr/share/retroarch/assets"))
+ else if (path_is_directory("@retroarch_assets_path@/share/retroarch/assets"))
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS],
- "/usr/share/retroarch",
+ "@retroarch_assets_path@/share/retroarch",
"assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
- else if (path_is_directory("/usr/local/share/games/retroarch/assets"))
+ else if (path_is_directory("@retroarch_assets_path@/local/share/games/retroarch/assets"))
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS],
- "/usr/local/share/games/retroarch",
+ "@retroarch_assets_path@/local/share/games/retroarch",
"assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
- else if (path_is_directory("/usr/share/games/retroarch/assets"))
+ else if (path_is_directory("@retroarch_assets_path@/share/games/retroarch/assets"))
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS],
- "/usr/share/games/retroarch",
+ "@retroarch_assets_path@/share/games/retroarch",
"assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
else
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], base_path,
--
2.38.1

View File

@ -0,0 +1,34 @@
From 6960855a0cdfd671d214030260b340a73878af52 Mon Sep 17 00:00:00 2001
From: Thiago Kenji Okada <thiagokokada@gmail.com>
Date: Fri, 23 Dec 2022 21:42:15 +0000
Subject: [PATCH] Use default values for libretro_info_path/assets_directories
---
configuration.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/configuration.c b/configuration.c
index d9ab8370c4..15b575d8a2 100644
--- a/configuration.c
+++ b/configuration.c
@@ -1483,7 +1483,7 @@ static struct config_path_setting *populate_settings_path(
SETTING_PATH("core_options_path",
settings->paths.path_core_options, false, NULL, true);
SETTING_PATH("libretro_info_path",
- settings->paths.path_libretro_info, false, NULL, true);
+ settings->paths.path_libretro_info, false, NULL, false);
SETTING_PATH("content_database_path",
settings->paths.path_content_database, false, NULL, true);
SETTING_PATH("cheat_database_path",
@@ -1539,7 +1539,7 @@ static struct config_path_setting *populate_settings_path(
SETTING_PATH("core_assets_directory",
settings->paths.directory_core_assets, true, NULL, true);
SETTING_PATH("assets_directory",
- settings->paths.directory_assets, true, NULL, true);
+ settings->paths.directory_assets, true, NULL, false);
SETTING_PATH("dynamic_wallpapers_directory",
settings->paths.directory_dynamic_wallpapers, true, NULL, true);
SETTING_PATH("thumbnails_directory",
--
2.38.1

View File

@ -1,41 +0,0 @@
From 6145cb9ed935621f1974655fe1ab44cf2f0fbcce Mon Sep 17 00:00:00 2001
From: Thiago Kenji Okada <thiagokokada@gmail.com>
Date: Sat, 29 Oct 2022 12:27:55 +0100
Subject: [PATCH] Use fixed path for libretro_core_info
---
configuration.c | 2 +-
frontend/drivers/platform_unix.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/configuration.c b/configuration.c
index af3fc8f43c..c6d56308b3 100644
--- a/configuration.c
+++ b/configuration.c
@@ -1468,7 +1468,7 @@ static struct config_path_setting *populate_settings_path(
SETTING_PATH("core_options_path",
settings->paths.path_core_options, false, NULL, true);
SETTING_PATH("libretro_info_path",
- settings->paths.path_libretro_info, false, NULL, true);
+ settings->paths.path_libretro_info, false, NULL, false);
SETTING_PATH("content_database_path",
settings->paths.path_content_database, false, NULL, true);
SETTING_PATH("cheat_database_path",
diff --git a/frontend/drivers/platform_unix.c b/frontend/drivers/platform_unix.c
index fe5f7341c9..c2a91f8c99 100644
--- a/frontend/drivers/platform_unix.c
+++ b/frontend/drivers/platform_unix.c
@@ -1799,8 +1799,8 @@ static void frontend_unix_get_env(int *argc,
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], base_path,
"core_info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
#else
- fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], base_path,
- "cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
+ fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], "@libretro_info_path@",
+ "share/libretro/info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
#endif
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG], base_path,
"autoconfig", sizeof(g_defaults.dirs[DEFAULT_DIR_AUTOCONFIG]));
--
2.38.0