diff --git a/emulator_settings.xml b/emulator_settings.xml
new file mode 100644
index 0000000..d893dc7
--- /dev/null
+++ b/emulator_settings.xml
@@ -0,0 +1,13 @@
+
+
+
+ ppsspp
+ /opt/retropie/configs/psp/PSP/SAVEDATA
+ /opt/retropie/configs/psp/PSP/PPSSPP_STATE
+
+ SYS
+ PNG
+ SFO
+
+
+
\ No newline at end of file
diff --git a/rclone_script.sh b/rclone_script.sh
index 26e9cf1..c7d6364 100644
--- a/rclone_script.sh
+++ b/rclone_script.sh
@@ -14,6 +14,9 @@ config=~/scripts/rclone_script/rclone_script.ini
source ${config}
logLevel=2
+# include emulator specific settings
+emu_settings=~/scripts/rclone_script/emulator_settings.xml
+
# parameters
direction="$1"
@@ -139,6 +142,41 @@ function prepareFilter ()
filter="${filter//\]/\\]}"
}
+# Builds a filter compatible with Find
+function prepareLocalFilter ()
+{
+ # Create an array of save file extensions
+ read -a exts <<< $(xmlstarlet sel -t -m "emulators/emulator[name='${emulator}']/saveFileExtensions" -v . "${emu_settings}")
+
+ # If any custom save file extensions are defined
+ if [ ${#exts[@]} -gt 0 ]
+ then
+ # Build the filter for the extensions
+ log 3 "Custom save extentions defined for emulator: ${emulator}"
+ localFilter="\( -iname '*.${exts[0]}'"
+ for ext in ${exts[@]:1}; do
+ localFilter="${localFilter} -o -iname '*.${ext}'"
+ done
+ localFilter="${localFilter} \)"
+ else
+ # Otherwise, default to ".*"
+ localFilter="${romfilebase//\[/\\[}"
+ localFilter="${localFilter//\]/\\]}"
+ fi
+
+ log 3 "Local save file filter: ${localFilter}"
+}
+
+function prepareRemoteFilter ()
+{
+
+}
+
+function getSavePathForEmulator ()
+{
+
+}
+
function getTypeOfRemote ()
{
# list all remotes and their type
@@ -350,6 +388,7 @@ log 3 "romfileext: ${romfileext}"
if [ "${direction}" == "up" ] && [ "${system}" != "kodi" ]
then
getROMFileName
+ prepareLocalFilter
prepareFilter
getTypeOfRemote
uploadSaves