nixpkgs-suyu/pkgs/misc/emulators/retroarch/0002-Use-fixed-paths-on-libretro_info_path.patch
Thiago Kenji Okada 03e35cfb65 retroarch: use fixed paths on "libretro_info_path"
This commit introduces a patch that hardcodes "libretro_info_path"
directly in the RetroArch code, without the issues of the previous
approach.

With this commit, RetroArch stops reading "libretro_info_path" from
`retroarch.cfg` file, and always use the default.
2021-11-20 16:34:01 -03:00

80 lines
4 KiB
Diff

From 6788718299e1aba3ff8b31cd6ef012e8d3643bd3 Mon Sep 17 00:00:00 2001
From: Thiago Kenji Okada <thiagokokada@gmail.com>
Date: Sat, 20 Nov 2021 15:59:23 -0300
Subject: [PATCH 2/2] 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 | 8 ++++----
3 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/configuration.c b/configuration.c
index e6a3841324..afb1d6e2ce 100644
--- a/configuration.c
+++ b/configuration.c
@@ -1456,7 +1456,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 f922e50c55..52732f65ae 100644
--- a/frontend/drivers/platform_darwin.m
+++ b/frontend/drivers/platform_darwin.m
@@ -383,14 +383,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 722e1c595c..d87e01cf12 100644
--- a/frontend/drivers/platform_unix.c
+++ b/frontend/drivers/platform_unix.c
@@ -1815,8 +1815,8 @@ static void frontend_unix_get_env(int *argc,
strcpy_literal(base_path, "retroarch");
#endif
- 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
@@ -1825,8 +1825,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.31.1