1
+ #! /bin/bash
2
+
3
+ XDG_DATA_HOME=${XDG_DATA_HOME:- $HOME / .local/ share}
4
+
5
+ if [ -d " /opt/system/Tools/PortMaster/" ]; then
6
+ controlfolder=" /opt/system/Tools/PortMaster"
7
+ elif [ -d " /opt/tools/PortMaster/" ]; then
8
+ controlfolder=" /opt/tools/PortMaster"
9
+ elif [ -d " $XDG_DATA_HOME /PortMaster/" ]; then
10
+ controlfolder=" $XDG_DATA_HOME /PortMaster"
11
+ else
12
+ controlfolder=" /roms/ports/PortMaster"
13
+ fi
14
+
15
+ source $controlfolder /control.txt
16
+ [ -f " ${controlfolder} /mod_${CFW_NAME} .txt" ] && source " ${controlfolder} /mod_${CFW_NAME} .txt"
17
+ get_controls
18
+
19
+ # Variables
20
+ GAMEDIR=" /$directory /ports/digitaltamersreborn"
21
+ BIG_SCALE=4000
22
+ BIG_DELAY=8
23
+ SMALL_SCALE=6000
24
+ SMALL_DELAY=16
25
+
26
+ # CD and set permissions
27
+ cd $GAMEDIR
28
+ > " $GAMEDIR /log.txt" && exec > >( tee " $GAMEDIR /log.txt" ) 2>&1
29
+ $ESUDO chmod +x -R $GAMEDIR /*
30
+
31
+ # Exports
32
+ export PATCHER_FILE=" $GAMEDIR /tools/patchscript"
33
+ export PATCHER_GAME=" $( basename " ${0% .* } " ) " # This gets the current script filename without the extension
34
+ export PATCHER_TIME=" 2 to 5 minutes"
35
+ export SDL_GAMECONTROLLERCONFIG=" $sdl_controllerconfig "
36
+
37
+ # Check if patchlog.txt to skip patching
38
+ if [ ! -f patchlog.txt ]; then
39
+ if [ -f " $controlfolder /utils/patcher.txt" ]; then
40
+ source " $controlfolder /utils/patcher.txt"
41
+ $ESUDO kill -9 $( pidof gptokeyb)
42
+ else
43
+ echo " This port requires the latest version of PortMaster."
44
+ fi
45
+ else
46
+ echo " Patching process already completed. Skipping."
47
+ fi
48
+
49
+ # Post patcher setup
50
+ export PORT_32BIT=" Y"
51
+ [ -f " ${controlfolder} /mod_${CFW_NAME} .txt" ] && source " ${controlfolder} /mod_${CFW_NAME} .txt"
52
+ export LD_LIBRARY_PATH=" /usr/lib32:$GAMEDIR /lib:$LD_LIBRARY_PATH "
53
+
54
+ # Apply mouse scaling according to screen size
55
+ if [ $DISPLAY_WIDTH -gt 480 ]; then
56
+ sed -i " s/^mouse_scale *= *[0-9]\+/mouse_scale = $BIG_SCALE /" " $GAMEDIR /dtr.gptk"
57
+ sed -i " s/^mouse_delay *= *[0-9]\+/mouse_delay = $BIG_DELAY /" " $GAMEDIR /dtr.gptk"
58
+ else
59
+ sed -i " s/^mouse_scale *= *[0-9]\+/mouse_scale = $SMALL_SCALE /" " $GAMEDIR /dtr.gptk"
60
+ sed -i " s/^mouse_delay *= *[0-9]\+/mouse_delay = $SMALL_DELAY /" " $GAMEDIR /dtr.gptk"
61
+ fi
62
+
63
+ # Display loading splash
64
+ if [ -f " $GAMEDIR /patchlog.txt" ]; then
65
+ [ " $CFW_NAME " == " muOS" ] && $ESUDO ./tools/splash " splash.png" 1
66
+ $ESUDO ./tools/splash " splash.png" 2000 &
67
+ fi
68
+
69
+ # Assign gptokeyb and load the game
70
+ $GPTOKEYB " gmloadernext.armhf" -c " dtr.gptk" &
71
+ pm_platform_helper " $GAMEDIR /gmloadernext.armhf" > /dev/null
72
+ ./gmloadernext.armhf -c gmloader.json
73
+
74
+ # Cleanup
75
+ pm_finish
0 commit comments