blob: 9689f468e935347f6df0976ca815c0a2da66430a (
plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
#!/bin/bash
set -e
declare -a games
GAME_INSTALLED=$(gamechest list | grep -i true | cut -d ":" -f 1 | cut -d " " -f 1)
populate_games()
{
for game in "${GAME_INSTALLED}"; do
games+=($game)
done
}
choose_game()
{
local choice_array=()
local shortcut_count=0
for game in "${games[@]}"; do
shortcut_count=$(( $shortcut_count + 1 ))
choice_array+=( "$game" "[$shortcut_count] $game" )
done
local dialog_args=(
--stdout
--clear
--backtitle "Games selection"
--title "List of installed games"
#--default-item "${games[-1]}"
--menu "Choose one of the following game:" 0 0 0
"${choice_array[@]}"
)
dialog "${dialog_args[@]}"
}
populate_profiles()
{
for profile in "dragoncat blackmoor calendros guest malice loudivine airi adetess"; do
profiles+=($profile)
done
}
choose_profile()
{
local choice_array=()
local shortcut_count=0
for profile in "${profiles[@]}"; do
shortcut_count=$(( $shortcut_count + 1 ))
choice_array+=( "$profile" "[$shortcut_count] $profile" )
done
local dialog_args=(
--stdout
--clear
--backtitle "Profiles selection"
--title "List of avalaible profiles"
#--default-item "${profiles[-1]}"
--menu "Choose one of the following profile:" 0 0 0
"${choice_array[@]}"
)
dialog "${dialog_args[@]}"
}
main()
{
# Game
populate_games
if [ ${#games[*]} -eq 0 ]; then echo "No game installed, bye."; exit 0; fi
if [ ${#games[*]} -eq 1 ]; then
game=${games[0]}
else
game=$(choose_game)
fi
# Profile
populate_profiles
if [ ${#profiles[*]} -eq 0 ]; then echo "No profile available, bye."; exit 0; fi
if [ ${#profiles[*]} -eq 1 ]; then
profile=${profiles[0]}
else
profile=$(choose_profile)
fi
echo "Running $game with $profile profile"
exec gamechest run --profile_id=$profile $game
}
main
|