nixpkgs-suyu/pkgs/applications/emulators/retroarch/use-fixed-paths-on-libretro_info_path.patch
2022-04-08 17:27:10 +01:00

84 lines
4.2 KiB
Diff

From 7bf021529ff15ca2580b15b3c0bfdc137d5beffe Mon Sep 17 00:00:00 2001
From: Thiago Kenji Okada <thiagokokada@gmail.com>
Date: Wed, 9 Mar 2022 18:24:15 +0000
Subject: [PATCH] Use fixed paths on "libretro_info_path"
This patch sets "libretro_info_path" to `handle = false`, so instead of
using the values from `retroarch.cfg`, it will always use the default.
Also, it patches the default "libretro_info_path" to the
`@libretro_info_path` string, so we can substitute it with the full path
to it during build.
---
configuration.c | 2 +-
frontend/drivers/platform_darwin.m | 9 ++-------
frontend/drivers/platform_unix.c | 12 ++++--------
3 files changed, 7 insertions(+), 16 deletions(-)
diff --git a/configuration.c b/configuration.c
index 7e346ff6e9..c4b2100203 100644
--- a/configuration.c
+++ b/configuration.c
@@ -1466,7 +1466,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_darwin.m b/frontend/drivers/platform_darwin.m
index 6c5fdca400..552dcb7e2b 100644
--- a/frontend/drivers/platform_darwin.m
+++ b/frontend/drivers/platform_darwin.m
@@ -388,14 +388,9 @@ static void frontend_darwin_get_env(int *argc, char *argv[],
home_dir_buf, "shaders_glsl",
sizeof(g_defaults.dirs[DEFAULT_DIR_SHADER]));
#endif
-#ifdef HAVE_UPDATE_CORES
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE],
- home_dir_buf, "cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
-#else
- fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE],
- bundle_path_buf, "modules", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
-#endif
- fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], home_dir_buf, "info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
+ "@libretro_directory@", "", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
+ fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_INFO], "@libretro_info_path@", "", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_OVERLAY], home_dir_buf, "overlays", sizeof(g_defaults.dirs[DEFAULT_DIR_OVERLAY]));
#ifdef HAVE_VIDEO_LAYOUT
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT], home_dir_buf, "layouts", sizeof(g_defaults.dirs[DEFAULT_DIR_VIDEO_LAYOUT]));
diff --git a/frontend/drivers/platform_unix.c b/frontend/drivers/platform_unix.c
index b3b5dad173..7f1561e523 100644
--- a/frontend/drivers/platform_unix.c
+++ b/frontend/drivers/platform_unix.c
@@ -1820,12 +1820,8 @@ static void frontend_unix_get_env(int *argc,
strcpy_literal(base_path, "retroarch");
#endif
- if (!string_is_empty(libretro_directory))
- strlcpy(g_defaults.dirs[DEFAULT_DIR_CORE], libretro_directory,
- sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
- else
- fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], base_path,
- "cores", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
+ fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], "@libretro_directory@",
+ "", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE]));
#if defined(DINGUX)
/* On platforms that require manual core installation/
* removal, placing core info files in the same directory
@@ -1834,8 +1830,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@",
+ "", 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.32.0