mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2025-02-16 19:35:39 +00:00
Patches can now get downloaded
This commit is contained in:
parent
60fa87c16b
commit
9377502a9f
|
@ -15,17 +15,40 @@ hacks_db_setup() {
|
||||||
declare -g hacks_db_cmd="sqlite3 $hacks_db_path"
|
declare -g hacks_db_cmd="sqlite3 $hacks_db_path"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
db_sanitize() {
|
||||||
|
echo "$(echo "$1" | sed -e "s/'/''/g")"
|
||||||
|
}
|
||||||
|
|
||||||
check_romhacks_compatibility() {
|
check_romhacks_compatibility() {
|
||||||
# Register all crc32 checksums of potential base ROMs and their paths into the dictionary "base_roms"
|
# Add paths of locally available base roms to db
|
||||||
|
|
||||||
for rom_path in ${roms_folder}/*/*; do
|
for rom_path in ${roms_folder}/*/*; do
|
||||||
if [[ "$(basename "$rom_path")" != "systeminfo.txt" ]]; then
|
if [[ "$(basename "$rom_path")" != "systeminfo.txt" ]]; then
|
||||||
|
|
||||||
crc32="$($crc32_cmd "$rom_path")"
|
crc32="$($crc32_cmd "$rom_path")"
|
||||||
sanitized_path="$(echo "$rom_path" | sed -e "s/'/''/g")"
|
|
||||||
|
|
||||||
$hacks_db_cmd < <(echo "UPDATE bases SET local_path = '""$sanitized_path""' WHERE crc32 = '""$crc32""'")
|
$hacks_db_cmd < <(echo "UPDATE bases SET local_path = '""$(db_sanitize "$rom_path")""' WHERE crc32 = '""$crc32""'")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
install_romhack() {
|
||||||
|
# $1: name of romhack
|
||||||
|
|
||||||
|
set -exo pipefail
|
||||||
|
|
||||||
|
hack_name="$1"
|
||||||
|
infos=$($hacks_db_cmd "SELECT bases.system,bases.name,bases.local_path \
|
||||||
|
FROM bases JOIN rhacks ON bases.crc32 = rhacks.base_crc32 \
|
||||||
|
WHERE rhacks.name = '""$(db_sanitize "$1")""'")
|
||||||
|
|
||||||
|
IFS='|' read -r system base_name base_local_path <<< $infos
|
||||||
|
|
||||||
|
# download patchfile
|
||||||
|
wget -q "https://github.com/Libretto7/best-romhacks/raw/main/rhacks/$system/$base_name/$hack_name/patch.tar.xz" -O "/tmp/patch.tar.xz"
|
||||||
|
|
||||||
|
patchfile_name=$(tar -xvf "/tmp/patch.tar.xz" --directory="$roms_folder/$system")
|
||||||
|
echo "$patchfile_name"
|
||||||
|
|
||||||
|
flips="flatpak-spawn --host flatpak run com.github.Alcaro.Flips"
|
||||||
|
}
|
||||||
|
|
|
@ -103,6 +103,8 @@ source /app/libexec/global.sh
|
||||||
# DIALOG TREE FUNCTIONS
|
# DIALOG TREE FUNCTIONS
|
||||||
|
|
||||||
configurator_welcome_dialog() {
|
configurator_welcome_dialog() {
|
||||||
|
configurator_romhack_downloader_dialog
|
||||||
|
|
||||||
if [[ $developer_options == "true" ]]; then
|
if [[ $developer_options == "true" ]]; then
|
||||||
welcome_menu_options=("Presets & Settings" "Here you find various presets, tweaks and settings to customize your RetroDECK experience" \
|
welcome_menu_options=("Presets & Settings" "Here you find various presets, tweaks and settings to customize your RetroDECK experience" \
|
||||||
"Open Emulator" "Launch and configure each emulators settings (for advanced users)" \
|
"Open Emulator" "Launch and configure each emulators settings (for advanced users)" \
|
||||||
|
@ -1430,6 +1432,7 @@ configurator_romhack_downloader_dialog() {
|
||||||
"${zenity_columns[@]}" )
|
"${zenity_columns[@]}" )
|
||||||
|
|
||||||
echo "$choice"
|
echo "$choice"
|
||||||
|
install_romhack "$choice" && echo "success"
|
||||||
|
|
||||||
configurator_welcome_dialog
|
configurator_welcome_dialog
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue