Skip to content

Commit

Permalink
Core downloads on batches of 5 parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
dragoonDorise committed Jan 2, 2025
1 parent 00a8f1c commit 2ce544d
Showing 1 changed file with 25 additions and 27 deletions.
52 changes: 25 additions & 27 deletions functions/EmuScripts/emuDeckRetroArch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2255,15 +2255,14 @@ RetroArch_finalize(){

RetroArch_installCores(){

#Requests for:
#GP32
#N-gage
#Game.com

# Requests for:
# GP32
# N-gage
# Game.com

mkdir -p "$RetroArch_cores"

#This is all the cores combined, and dupes taken out.
# This is all the cores combined, and dupes taken out.
RAcores=(
81_libretro \
a5200_libretro \
Expand Down Expand Up @@ -2359,34 +2358,33 @@ RetroArch_installCores(){
wasm4_libretro \
x1_libretro \
)

setMSG "Downloading RetroArch Cores for EmuDeck"
for i in "${RAcores[@]}"
do
FILE="${RetroArch_cores}/${i}.*"
if [ -f "$FILE" ]; then
echo "${i}...Already Downloaded"
else
curl "$RetroArch_coresURL$i.$RetroArch_coresExtension" --output "$RetroArch_cores/${i}.zip"

#rm ~/.var/app/org.libretro.RetroArch/config/retroarch/cores/${i}.zip
echo "${i}...Downloaded!"
fi
done

batch_size=5
total=${#RAcores[@]}
for ((i=0; i<$total; i+=batch_size)); do
batch=("${RAcores[@]:i:batch_size}")

for core in "${batch[@]}"; do
FILE="${RetroArch_cores}/${core}.*"
if [ -f "$FILE" ]; then
echo "${core}...Already Downloaded"
else
curl "$RetroArch_coresURL$core.$RetroArch_coresExtension" --output "$RetroArch_cores/${core}.zip" &
fi
done

for entry in "$RetroArch_cores"/*.zip
do
unzip -q -o "$entry" -d "$RetroArch_cores"
wait # Wait for the current batch to finish
done

for entry in "$RetroArch_cores"/*.zip

do
rm -f "$entry"
for entry in "$RetroArch_cores"/*.zip; do
unzip -q -o "$entry" -d "$RetroArch_cores"
done



for entry in "$RetroArch_cores"/*.zip; do
rm -f "$entry"
done
}

#RetroArch_dlAdditionalFiles
Expand Down

0 comments on commit 2ce544d

Please sign in to comment.