Skip to content

Commit 9295084

Browse files
committed
avoid surplus downloads
1 parent cec724f commit 9295084

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

scriptmodules/ports/gmloader.sh

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# "libisl.so.23: ELF load command address/offset not page-aligned"
1818
#
1919
# - This script can not be exucuted in steps (e.g. depends, sources, build,
20-
# install, configure) as it will resets the gcc:armhf installation to
20+
# install, configure) as it will reset the gcc:armhf installation to
2121
# gcc:arm64.
2222
#
2323

@@ -197,19 +197,23 @@ function install_gmloader() {
197197

198198
function configure_gmloader() {
199199
local apk_dir="$romdir/ports/droidports"
200-
local maldita_url="https://github.com/Exarkuniv/game-data/raw/main/Maldita_Castilla_ouya.apk"
201200
local am2r_url="https://archive.org/download/am-2-r-1.5.5-for-android/AM2R%20v1.5.5%20for%20Android.apk"
201+
local maldita_url="https://github.com/Exarkuniv/game-data/raw/main/Maldita_Castilla_ouya.apk"
202202
local spelunky_url="https://github.com/yancharkin/SpelunkyClassicHD/releases/download/1.1.7-optimized/spelunky_classic_hd-android-armv7.apk"
203203

204204
if [[ "$md_mode" == "install" ]]; then
205205
mkUserDir "$apk_dir"
206206
local dl_url
207-
for dl_url in "$maldita_url" "$am2r_url" "$spelunky_url"; do
208-
local apk_file="$apk_dir/$(basename ${dl_url})"
207+
for dl_url in "$am2r_url" "$maldita_url" "$spelunky_url"; do
208+
local dest_file
209+
dest_file=$(basename ${dl_url})
210+
if case "$dest_file" in AM2R*) ;; *) false;; esac; then
211+
dest_file="AM2R.apk"
212+
fi
213+
local apk_file="$apk_dir/$dest_file"
209214
if [[ ! -f "$apk_file" ]]; then
210-
download "$dl_url" "$apk_dir"
215+
download "$dl_url" "$apk_file"
211216
chown $user:$user "$apk_file"
212-
mv -f $apk_dir/AM2R%20v1.5.5%20for%20Android.apk $apk_dir/AM2R.apk
213217
fi
214218
done
215219

@@ -240,12 +244,15 @@ _EOF_
240244
fi
241245
fi
242246

243-
local maldita_file="$apk_dir/$(basename ${maldita_url})"
244-
local spelunky_file="$apk_dir/$(basename ${spelunky_url})"
245-
local am2r_file="$apk_dir/$(basename ${am2r_url})"
247+
local am2r_file
248+
local maldita_file
249+
local spelunky_file
250+
am2r_file="$apk_dir/AM2R.apk"
251+
maldita_file="$apk_dir/$(basename ${maldita_url})"
252+
spelunky_file="$apk_dir/$(basename ${spelunky_url})"
253+
addPort "$md_id" "droidports" "AM2R - Another Metroid 2 Remake" "$md_inst/gmlauncher.sh %ROM%" "$am2r_file"
246254
addPort "$md_id" "droidports" "Maldita Castilla" "$md_inst/gmlauncher.sh %ROM%" "$maldita_file"
247255
addPort "$md_id" "droidports" "Spelunky Classic HD" "$md_inst/gmlauncher.sh %ROM%" "$spelunky_file"
248-
addPort "$md_id" "droidports" "AM2R - Another Metroid 2 Remake" "$md_inst/gmlauncher.sh %ROM%" "$am2r_file"
249256

250257
moveConfigDir "$home/.config/gmloader" "$md_conf_root/droidports"
251258
}

0 commit comments

Comments
 (0)