summaryrefslogtreecommitdiffstats
path: root/.local/bin/emu
blob: 2087af6e85491e1213637d4e04cb805601b59e0b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash

# variables
rclone_source="myrient-ftp"
# dependencies=("rclone" "mount-zip" "retroarch")
# cores=$(grep core $0)

# check for remote
# if ! $(rclone listremotes | grep $rclone_source)

#	games_db+=("cores" "bios" "clean" "dependencies")

case "$1" in
	2600) path="No-Intro/Atari - 2600" && core="stella" ;;
	3ds) path="No-Intro/Nintendo - Nintendo 3DS (Decrypted)" && core="citra" ;;
	dmg) path="No-Intro/Nintendo - Game Boy" && core="sameboy" ;;
	gba) path="No-Intro/Nintendo - Game Boy Advance" && core="mgba" ;;
	gbc) path="No-Intro/Nintendo - Game Boy Color" && core="sameboy" ;;
	n64) path="No-Intro/Nintendo - Nintendo 64 (BigEndian)" && core="mupen64plus_next" ;;
	nds) path="No-Intro/Nintendo - Nintendo DS (Decrypted)" && core="melonds" ;;
	nes) path="No-Intro/Nintendo - Nintendo Entertainment System (Headerless)" && core="mesen" ;;
	ngc) path="Redump/Nintendo - GameCube - NKit RVZ [zstd-19-128k]" && core="dolphin" ;;
	ps1) path="Redump/Sony - PlayStation" && core="swanstation" ;;
	ps2) path="Redump/Sony - PlayStation 2" && core="pcsx2" ;;
	psp) path="Redump/Sony - PlayStation Portable" && core="ppsspp" ;;
	sdc) path="Redump/Sega - Dreamcast" && core="flycast" ;;
	smcd) path="Redump/Sega - Mega CD & Sega CD" && core="genesis_plus_gx" ;;
	smd) path="No-Intro/Sega - Mega Drive - Genesis" && core="genesis_plus_gx" ;;
	snes) path="No-Intro/Nintendo - Super Nintendo Entertainment System" && core="snes9x" ;;
	wii) path="Redump/Nintendo - Wii - NKit RVZ [zstd-19-128k]" && core="dolphin" ;;
	*) printf "Systems available: %s\\n" "$(grep -E 'path.*core' "$0" | cut -f1 -d")" | xargs)" && exit 0 ;;
esac

printf "Mounting directory..."
temp_directory=$(mktemp -d)
cd "$temp_directory" || exit
mkdir -p mount archive
rclone mount "$rclone_source":"$path" mount --daemon
printf "done\\n"

printf "Mounting ROM..."
mount-zip --precache "mount/$(rclone lsf "$rclone_source":"$path" | fzf --prompt "$1>" )" archive
printf "done\\n"

printf "Finding ROM..."
romfile="$(find archive -type f -print | head -1)"
printf "%s done \\n" "$romfile"

printf "Launching %s with %s..." "$romfile" "$core"
retroarch -L "$HOME/.config/retroarch/cores/${core}_libretro.so" "$romfile"
printf "done\\n"

printf "Tidying up..."
umount archive
sleep 1s
fusermount -uz mount
rm -r "$temp_directory"
printf "done\\n"