-
Notifications
You must be signed in to change notification settings - Fork 7
/
cooplauncher
60 lines (54 loc) · 2.38 KB
/
cooplauncher
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
59
60
#!/bin/bash
# This is a temporary launcher for sm64ex-coop until network configuration is added in-game,
# primary intended for use when sm64ex-coop was installed with smlinux.
# 2020-0902-1354
getip(){
IP=`zenity --entry --text="XXX.XXX.XXX.XXX XXXX" --title "Host Address" --width 211`
if [ -z $IP ]; then
zenity --error --text "Nothing entered! Try again with a full ip address and port number." --width 211
exit
else
echo $IP > ${XDG_DATA_HOME:-$HOME/.local/share}/sm64ex-coop/hostip.txt
fi
}
getport(){
PORT=`zenity --entry --text="Enter Port Number" --title "Host Port" --width 211`
if [ -z $PORT ]; then
zenity --error --text "Nothing entered! Try again with a 4-digit port number." --width 211
exit
else
echo $PORT > ${XDG_DATA_HOME:-$HOME/.local/share}/sm64ex-coop/hostport.txt
fi
}
if [ "$1" = "local" ]; then
./sm64.us.f3dex2e --server 27015 --cheats --savepath ${XDG_DATA_HOME:-$HOME/.local/share}/sm64ex-coop --skip-intro --configfile sm64config.server-local.txt &
./sm64.us.f3dex2e --client 127.0.0.1 27015 --cheats --savepath ${XDG_DATA_HOME:-$HOME/.local/share}/sm64ex-coop --skip-intro
exit
fi
exec 2> >(grep -v GtkDialog >&2) # Supress GTK Dialog Warnings
if zenity --question --text="Player 1 (Mario) Host Server\n\nPlayer 2 (Luigi) Client" --title "Player Selection" --ok-label="Client" --cancel-label="Server" --width 211; then
if [ -f ${XDG_DATA_HOME:-$HOME/.local/share}/sm64ex-coop/hostip.txt ]; then
if zenity --question --text="Reconnect to\n`cat ${XDG_DATA_HOME:-$HOME/.local/share}/sm64ex-coop/hostip.txt`?" --title "Host Address" --width 211; then
IP=`cat ${XDG_DATA_HOME:-$HOME/.local/share}/sm64ex-coop/hostip.txt`
else
getip
fi
else
getip
fi
./sm64.us.f3dex2e --client $IP --cheats --savepath ${XDG_DATA_HOME:-$HOME/.local/share}/sm64ex-coop --skip-intro
else
if [ -f ${XDG_DATA_HOME:-$HOME/.local/share}/sm64ex-coop/hostport.txt ]; then
if zenity --question --text="Serve on Port `cat ${XDG_DATA_HOME:-$HOME/.local/share}/sm64ex-coop/hostport.txt`?" --title "Host Port" --width 211; then
PORT=`cat ${XDG_DATA_HOME:-$HOME/.local/share}/sm64ex-coop/hostport.txt`
fi
fi
if [ -z $PORT ]; then
if zenity --question --text="Serve on Port 7777?" --title "Host Port" --width 211; then
PORT=7777
else
getport
fi
fi
./sm64.us.f3dex2e --server $PORT --cheats --savepath ${XDG_DATA_HOME:-$HOME/.local/share}/sm64ex-coop --skip-intro
fi