Skip to content

Commit af80d8f

Browse files
authored
Merge pull request #2 from josegonzalez/simplify-detection
chore: simplify process detection
2 parents 7bb4703 + ee6fc4a commit af80d8f

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

bin/screenshot

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,25 @@
11
#!/bin/sh
22

33
get_screenshot_prefix() {
4-
screenshot_prefix="$(cat /mnt/SDCARD/.userdata/shared/.minui/recent.txt | head -n1 | cut -d$'\t' -f2)"
5-
if [ -z "$screenshot_prefix" ]; then
6-
screenshot_prefix="Screenshot"
4+
game_name="$(cat /mnt/SDCARD/.userdata/shared/.minui/recent.txt | head -n1 | cut -d$'\t' -f2)"
5+
if [ -z "$game_name" ]; then
6+
game_name="Screenshot"
77
fi
88

9-
is_running_minarch="false"
10-
is_running_mupen64plus="false"
11-
is_running_drastic="false"
12-
is_running_ppsspp="false"
9+
use_screenshot_prefix="false"
1310
if pgrep "minarch.elf" >/dev/null 2>&1; then
14-
is_running_minarch="true"
15-
fi
16-
if pgrep "mupen64plus" >/dev/null 2>&1; then
17-
is_running_mupen64plus="true"
18-
fi
19-
if pgrep "drastic" >/dev/null 2>&1; then
20-
is_running_drastic="true"
21-
fi
22-
if pgrep "PPSSPPSDL" >/dev/null 2>&1; then
23-
is_running_ppsspp="true"
11+
use_screenshot_prefix="true"
12+
elif pgrep "mupen64plus" >/dev/null 2>&1; then
13+
use_screenshot_prefix="true"
14+
elif pgrep "drastic" >/dev/null 2>&1; then
15+
use_screenshot_prefix="true"
16+
elif pgrep "PPSSPPSDL" >/dev/null 2>&1; then
17+
use_screenshot_prefix="true"
2418
fi
2519

26-
if [ "$is_running_minarch" = "false" ] && [ "$is_running_mupen64plus" = "false" ] && [ "$is_running_drastic" = "false" ] && [ "$is_running_ppsspp" = "false" ]; then
27-
screenshot_prefix="Screenshot"
20+
screenshot_prefix="Screenshot"
21+
if [ "$use_screenshot_prefix" != "true" ]; then
22+
screenshot_prefix="$game_name"
2823
fi
2924

3025
echo "$screenshot_prefix"

0 commit comments

Comments
 (0)