-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Expand the path name of the per-content-directory-override-config-file #12021
Comments
I have a need for content-directory for subfolders too. There are two use cases for me:
I would like to have a method to apply the content-directory-override to mods_msu-1 once.
As a workaround for this one, I have to create unique subfolder names, that are unique to the entire collection, in example gb_mods. This is tedious and requires all playlists to be updated. So I highly support your request and would make my life much easier to work with this. |
Just came across the same issue with my Sega CD collection, +1 to the request. IMO Content Directory applying to all subfolders is sane default. |
Same issue here : I have a "Content Directory Overrides" which doesn't work with subfolder. It works great but there is an exception : if multiple directory config override are found, it will try to find the right config file thanks to the core name, but the problem is that there is a lack of standardization on RA cores : the config folder doesn't always correspond to the core file name 😕 (for example gw_libretro.so core will save its config in "config/Game & Watch" folder). You'll find similar difficulties in scripting with saves or savestates, the lack of standardization is often a problem to automatize some tasks. I share my script here, may be some of you will find it useful : My emu launch script : #!/bin/sh
RA_DIR=/mnt/SDCARD/RetroArch
cd $RA_DIR/
source /mnt/SDCARD/RetroArch/FolderOverrideFinder.sh
HOME=$RA_DIR/ $RA_DIR/retroarch -v -L $RA_DIR/.retroarch/cores/gambatte_libretro.so "$@" My directory config override finder (FolderOverrideFinder.sh) : subdir_count=$(echo "$1" | awk -F'/Roms/' '{print $2}' | awk -F'/' '{print NF-1}') # Count the number of slashes in the rest of the path
if [ "$subdir_count" -gt 1 ]; then
if [ -z "$2" ]; then # the override is not already defined
echo "############### Folder Overrride Finder ###############"
first_subdir=$(echo "$1" | awk -F'/Roms/' '{print $2}' | cut -d'/' -f1) # Use awk to extract the part of the path after "/mnt/SDCARD/Roms/" to the next "/".
echo "Subdirectory from $first_subdir detected !"
# we try to find the folder override
result=$(find /mnt/SDCARD/RetroArch/.retroarch/config/ -name "$first_subdir.cfg")
num_lines=$(echo "$result" | wc -l)
if [ $num_lines -eq 1 ]; then
FolderOverride="$result"
else
# if we find multiple folder override config files, we try to find the right one depending the core name
core_name=$(grep '^[[:space:]]*HOME=' "$0" | grep '_libretro\.so' | sed -E 's/.*cores\/([^_]+)_libretro\.so.*/\1/')
core_config=$(echo "$result" | grep -i "$core_name")
if [ -z "$core_config" ]; then
FolderOverride="" # We didn't found it (we avoid to select one by default : FolderOverride=$(echo "$result" | head -n 1))
else
FolderOverride="$core_config"
fi
echo "Roms root directory: $first_subdir"
echo core_name: $core_name
fi
if [ ! -z "$FolderOverride" ]; then
echo "Folder override found: $FolderOverride"
echo "#######################################################"
source "$0" "$1" --appendconfig "$FolderOverride"
exit
else
echo "Folder override not found"
echo "#######################################################"
fi
fi
else
echo "No subdirectory detected."
fi
You'll probably need to adapt it to your case because :
|
Deeply reworked for a more reliable result : now I use a core database made by my own : it indicates for a core filename the corresponding config path. My updated directory config override finder (FolderOverrideFinder.sh) : subdir_count=$(echo "$1" | awk -F'/Roms/' '{print $2}' | awk -F'/' '{print NF-1}') # Count the number of slashes in the rest of the path
if [ "$subdir_count" -gt 1 ]; then
if [ -z "$2" ]; then # the override config file is not already defined
echo "############### Folder Overrride Finder ###############"
first_subdir=$(echo "$1" | awk -F'/Roms/' '{print $2}' | cut -d'/' -f1) # Use awk to extract the part of the path after "/mnt/SDCARD/Roms/" to the next "/".
echo "Subdirectory from $first_subdir detected !"
# We try to find the config folder :
core_filename=$(grep '^[[:space:]]*HOME=' "$0" | grep '_libretro\.so' | sed -E 's/.*cores\/([^\/]+\.so).*/\1/') # we find the core filename in the launch script itself
core_folder=$(grep -m 1 "$core_filename" /mnt/SDCARD/core_folders.csv | cut -d';' -f2) # we use a core database which indicates for a core filename the corresponding config path
echo "The core folder for $core_filename is: $core_folder"
if [ -f "/mnt/SDCARD/RetroArch/.retroarch/config/$core_folder/$first_subdir.cfg" ]; then
FolderOverride="/mnt/SDCARD/RetroArch/.retroarch/config/$core_folder/$first_subdir.cfg"
else
# we try to find the folder override without the core database
result=$(find /mnt/SDCARD/RetroArch/.retroarch/config/ -name "$first_subdir.cfg")
num_lines=$(echo "$result" | wc -l)
if [ $num_lines -eq 1 ]; then
FolderOverride="$result"
else
# if we find multiple folder override config files, we try to find the right one depending the core name
core_name=$(grep '^[[:space:]]*HOME=' "$0" | grep '_libretro\.so' | sed -E 's/.*cores\/([^\/]+)_libretro\.so.*/\1/' | cut -d'_' -f1)
result=$(echo "$result" | grep -i "$core_name/")
num_lines=$(echo "$result" | wc -l)
if [ $num_lines -eq 1 ]; then
FolderOverride="$result"
else
if [ $num_lines -ne 0 ]; then
# less restrictive comparison :
result=$(echo "$result" | grep -i "$core_name")
num_lines=$(echo "$result" | wc -l)
if [ $num_lines -eq 1 ]; then
FolderOverride="$result" # (we avoid to select one by default : FolderOverride=$(echo "$result" | head -n 1))
elif [ $num_lines -gt 1 ]; then
echo "Multiple possibilities found, none selected"
fi
fi
fi
fi
fi
if [ ! -z "$FolderOverride" ]; then
echo "Folder override found: $FolderOverride"
echo "#######################################################"
source "$0" "$1" --appendconfig "$FolderOverride"
exit
else
echo "Folder override not found"
echo "#######################################################"
fi
fi
else
echo "No subdirectory detected."
fi
The database (which could be useful for other scripts too), core_folders.csv :
(the emu launch script has not changed) |
@schmurtzm I personally would not use this script, because I am experienced enough to create my own solution. Just wanted say that I admire other peoples scripting solutions to small problems like these. But this probably should be in its own repository or at least Gist that can be linked. Without looking into the details too much, I have an advice that I use doing manually for subfolders. You can just link a .cfg file with |
Adding FolderOverrideFinder.sh from Schmurtz : libretro/RetroArch#12021 (comment) Make the directory override work in the subolders.
My problem is that this config file only works for the folder in which my rom is directly placed.
To give you a better understanding what I mean, here is an example: My folder structure looks like that:
Games
As you see I don't have one savegame folder for all savegames, but separated by platforms.
My first attempt was to use the core-override-config-file to set an individual savegame path for each platform.
But then I realized that there are cores like Gambatte which are used for two or more platforms (GB & GBC).
So this won't work, since I can set only one savegame path per core and I would need two savegame paths in this case.
Then I discoverd the directory-override-config-option which is actually exactly what I need in this case.
But the problem is that the "directory" is limited on the folder in which my rom is directly placed.
So instead creating a config file which counts for all contents of the
"Roms"
folder, it only creates a config file which counts for the folder"Asterix"
since this is the next higher folder of the content which I've loaded.The name of the config file would be
"Asterix.cfg"
What I need is a config file named like
"Z-Games-Gameboy-Roms.cfg"
, which counts for all contents in the directory"Z:\Games\Gameboy\Roms"
This would make this override option much more useful in my opinion.
The text was updated successfully, but these errors were encountered: